pwCorrMat: Pairwise Correlation Matrix

pwCorrMatR Documentation

Pairwise Correlation Matrix

Description

Prints pairwise correlation matrix flagging statistically significant correlations using one of a few different methods.

Usage

pwCorrMat(
  formula,
  data,
  method = c("z", "t", "sim"),
  weight = NULL,
  alpha = 0.05,
  ...
)

Arguments

formula

A right-sided formula giving the variables to be correlated separated by pluses.

data

A data frame where the variables in the formula can be found.

method

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.

weight

A vector of weightings as long as there are rows in data.

alpha

Cutoff for identifying significant correlations.

...

Other arguments to be passed down to sig.cor.

Details

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.

Value

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.


davidaarmstrong/damisc documentation built on Oct. 1, 2023, 3:05 p.m.