Learn R Programming

CCP (version 1.2)

plt.asym: Plot asymptotic distributions for test statistics

Description

This function plots asymptotic distributions used to test the statistical significance of canonical correlation coefficients, see function p.asym.

Usage

plt.asym(p.asym.out, rhostart = 1)

Arguments

p.asym.out

output of p.asym, see example below.

rhostart

index of the largest canonical correlation coefficient included in the calculation of the test statistic, see function p.asym.

Details

Depending on what type of statistic was chosen in p.asym, an F-approximation for this statistic is plotted. The statistic is one of: Wilks' Lambda, Hotelling-Lawley Trace, Pillai-Bartlett Trace, or Roy's Largest Root. The value of the test statistic calculated from the canonical correlation coefficients is plotted as a vertical line; thus the area located below the curve and to the right of the vertical line corresponds to the p-value. The vertical line is not visible if the value of the test statistic is in the far tail of the distribution, resulting in a p-value which is (close to) zero. The numerical value of the test statistic, the numerator and denominator degrees of freedom of the F-distribution, and the p-value are plotted on the bottom of the figure.

See Also

See the function p.asym for the calculation of the p-values.

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)



## Calculate canonical correlations, 
## using the function "cancor" from the "stats" package:
rho <- cancor(X,Y)$cor

## Define number of observations, 
## and number of dependent and independent variables:
N = dim(X)[1]       
p = dim(X)[2]   
q = dim(Y)[2]


## Plot the F-approximation for Wilks' Lambda, 
## considering 3, 2, or 1 canonical correlation(s):
res1 <- p.asym(rho, N, p, q)
plt.asym(res1,rhostart=1)
plt.asym(res1,rhostart=2)
plt.asym(res1,rhostart=3)


## Plot the F-approximation for the Hotelling-Lawley Trace, 
## considering 3, 2, or 1 canonical correlation(s):
res2 <- p.asym(rho, N, p, q, tstat="Hotelling")
plt.asym(res2,rhostart=1)
plt.asym(res2,rhostart=2)
plt.asym(res2,rhostart=3)
# }

Run the code above in your browser using DataLab