Learn R Programming

CCP (version 1.2)

p.perm: Permutation test for the significance of canonical correlation coefficients

Description

This function runs a permutation test to assign the statistical significance of canonical correlation coefficients. Wilks' Lambda, the Hotelling-Lawley Trace, the Pillai-Bartlett Trace, or of Roy's Largest Root can be used as a test statistic.

Usage

p.perm(X, Y, nboot = 999, rhostart = 1, type = "Wilks")

Arguments

X

array containing the independent variables, with \(N\) rows (number of observations) and \(p\) columns (number of independent variables).

Y

array containing the dependent variables, with \(N\) rows (number of observations) and \(q\) columns (number of dependent variables).

nboot

number of permutation resamples calculated.

rhostart

index of the largest canonical correlation coefficient included in the calculation of the test statistic (see \(Details\)).

type

test statistic to be used. One of "Wilks" (default), "Hotelling", "Pillai", or "Roy".

Value

stat0

original value of the statistic (without resampling).

stat

\(nboot\) values of the statistic, one for each permutation resampling.

nexcess

number of permutation resamplings that resulted in a more extreme value of the statistic than \(stat0\).

p.value

p-value, derived from \(nexcess\).

Details

Permutation tests are based on resampling of the original data without replacement. To test the hypothesis of no correlation between two sets (X, Y) of variables, the values of one variable (Y) are randomly reassigned. Permutation tests do not require specific population distributions of the variables such as normal distribution. Canonical correlation analysis (CCA) calculates \(m = min(p,q)\) correlation coefficients, see p.asym. The coefficients are arranged in descending order of magnitude: \(rho[1] > rho[2] > rho[3] > ... > rho[m]\). In p.perm, the parameter \(rhostart\) determines how many correlation coefficients are included in the calculation of the test statistic: choosing \(rhostart=1\), all canonical correlations are included, choosing \(rhostart=2\), the biggest canonical correlation (\(rho[1]\)) is excluded, choosing \(rhostart=3\), both \(rho[1]\) and \(rho[2]\) are excluded, etc. On principle, Roy's Largest Root takes only \(rho[1]\) into account, hence only \(rhostart=1\) can be chosen.

References

Efron, B. and Tibshirani, R. J. (1994) An Introduction to the Bootstrap, Chapman & Hall, New York.

Moore, D. S. amd McCabe, G. P. (2006) Introduction to the Practice of Statistics, Chapter 14, W. H. Freeman, New York.

See Also

See the function cancor or the CCA package for the calculation of canonical correlation coefficients.

Examples

Run this code
# NOT RUN {
## Load the CCP package:
library(CCP)


## Simulate example data:
X <- matrix(rnorm(150), 50, 3)
Y <- matrix(rnorm(250), 50, 5)



## Run permutation test using Wilks Lambda (default) as test statistic; 
## include different numbers of canonical correlations:
p.perm(X, Y, nboot = 999, rhostart = 1)
p.perm(X, Y, nboot = 999, rhostart = 2)
p.perm(X, Y, nboot = 999, rhostart = 3)


## Run permutation tests based on different test statistics:
p.perm(X, Y, nboot = 999, rhostart = 1, type = "Wilks")        
p.perm(X, Y, nboot = 999, rhostart = 1, type = "Hotelling")
p.perm(X, Y, nboot = 999, rhostart = 1, type = "Pillai")
p.perm(X, Y, nboot = 999, rhostart = 1, type = "Roy")

## Plot the permutation distribution
## with the value of the original statistic marked:
out <- p.perm(X, Y, nboot = 999, rhostart = 3, type = "Hotelling")
plt.perm(out)
# }

Run the code above in your browser using DataLab