Prints pairwise correlation matrix flagging statistically significant correlations using one of a few different methods.
pwCorrMat(
formula,
data,
method = c("z", "t", "sim"),
weight = NULL,
alpha = 0.05,
...
)
A right-sided formula giving the variables to be correlated separated by pluses.
A data frame where the variables in the formula can be found.
A method for calculating the significance of the of the correlation - one of "z", "t" or "sim". When correlations are calculated with weights, a bootstrap is used to generate p-values regardless of the method specified. See details for more.
A vector of weightings as long as there are rows in data
.
Cutoff for identifying significant correlations.
Other arguments to be passed down to sig.cor
.
An object of class pwc
, which is a list with elements rSig
which is a lower-triangular correlation matrix where only significant correlations
are printed, r
which is the raw-data pairwise correlation matrix and
p
which gives the p-values of all of the correlations.
The significance is found through one of three ways. For correlation r
,
the z-transformation is .5*log((1+r)/(1-r)), the p-value for which is found using
the standard normal distribution. The t-transformation is r*sqrt((n-2)/(1-r^2)),
the p-value for which is found using a t-distribution with n-2 degrees of freedom.
The "sim" method uses a permutation test to build the sampling distribution of the
correlation under the null hypothesis and then calculates a p-value from that
distribution.