I'd like to adjust for multiple testing when plotting multiple correlation tests. corr.test from the psych package works well, but doesn't have a nice graphical output. I'm particularly interested in using ggpairs from the GGally package because it allows for multiple correlations per cell (for instance, split by species in the example below). But I can't seem to find a way to add in a p.adjust or similar statement.
For instance:
library(GGally)
data(flea)
ggpairs(flea, columns=2:4, ggplot2::aes(colour=species))
Performs 12 separate correlation tests and generates a nice plot that indicates significance levels with asterisks. But how to adjust for having done 12 correlation tests (instead of one)?
I would like to be able to do something like:
ggpairs(flea, columns=2:4, ggplot2::aes(colour=species, p.adjust="Bonferroni"))
This does not throw any errors. But it also results in, as far as I can tell, no difference in significance tests - it appears the p.adjust statement is being ignored.
1) Is it being ignored? How do you access the actual p-values and not just the *** to check this in more detail?
2) Assuming it is being ignored, how can I implement adjustments to the significance tests to account for multiple testing?
I am particularly interested in methods that can handle multiple types of adjustments not just Bonferroni. I use Bonferroni in the example because it is the most conservative and so (I thought) easiest to see differences between corrected/uncorrected output. I would like to use this to visualize results several dozens to hundreds of correlation tests with fdr corrections (or similar).
I had not, thanks for the suggestion. Perhaps I'm missing something here, but it doesn't appear to be that simple:
I also tried upper=list(continuous=holm_cors, continuous="holm_p", etc as well as wrapping the corr.test function with upper=list(continuous=wrap(corr.test)).
In all cases the upper panel returned is blank.