adjust.corr | R Documentation |
The adjust.corr
function produces correlation matrices from raw data frames
and produces standard normal theory t-test based p-values for all correlations
among pairs of variables. It will also produce adjusted p-values for the
simultaneous inference on whole correlation matrices.
adjust.corr(
x,
type = c("pearson", "spearman"),
use = c("complete.obs", "pairwise.complete.obs"),
adjust = "holm"
)
x |
A data frame or a correlation matrix. If there is missing data it is
safer to pass the original data and control how missing data are handled
with the |
type |
"pearson" or "spearman" permits specification of the type of correlation coefficient. |
use |
specifies how missing values are handled: "complete.obs" peeforms listwise deletion of cases and is the default; "pairwise.complete.obs" performs pairwise deletion. |
adjust |
Which p-value adjustment for multiple testing is to be used?
("holm", "hochberg", "hommel", "bonferroni", "BH", "BY", "fdr", "none").
The "holm" method is the default and is preferred to the "bonferroni" method.
The "hochberg" and "hommel" methods assume independence of the multiple tests and that
is unlikely for correlation matrices. The "BH" and "fdr" methods are equivalent and
produce the false discovery rate adjustment. See help for the |
The function takes a data frame or a correlation matrix. The former is preferred
to give control over the method of handling missing data. The correlation matrix
is returned, along with unadjusted and adjusted p-value matrices. Adjustment for simultaneous
inference utilizes thep.adjust
function from base R to accomplish the adjustments.
The p-values assume a two-tailed test. Internally the function uses "Hmisc::rcorr" to
calculate the correlation coefficients and to handle pairwise deletion when missing data
are present.
Similar capabilities can be found in the psych::corr.test
and psych::corr.p
functions which will also produce confidence intervals for the correlation coefficients.
Bruce Dudek bruce.dudek@albany.edu
This function is a modeled on a function originally coded
as the corr.adjust
function in the RcmdrMisc package.
adjust.corr(mtcars[,c(1,4:8)], use="complete.obs", adjust="fdr")
adjust.corr(mtcars[,c(1,4:8)], use="pairwise.complete.obs")
data(attitude)
adjust.corr(attitude, adjust="none")
M2 <- cor(mtcars[,c(1,4:8)])
adjust.corr(M2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.