Learn R Programming

multiUS (version 1.2.3)

cancorPlus: Canonical correlations

Description

The function computes canonical correlations (by using cc or cancor functions) and provides with the test of canonical correlations and with the eigenvalues of the canonical roots (including with the proportion of explained variances by correlation and other related statistics).

Usage

cancorPlus(x, y, xcenter = TRUE, ycenter = TRUE, useCCApackage = FALSE)

Value

The function returns the same output as functions cancor or cc with the following additional elements:

  • $sigTest

    • WilksL - Value of the Wilk's lambda statistic (it is a generalization of the multivariate R2; values near 0 indicate high correlation while values near 1 indicate low correlation).

    • F - Corresponding (to Wilk's lambda) F-ratio.

    • df1 - Degrees of freedom for the corresponding F-ratio.

    • df2 - Degrees of freedom for the corresponding F-ratio.

    • p - Probability value (p-value) for the corresponding F-ratio (Ho: The current and all the later canonical correlations equal to zero).

  • $eigModel

    • Eigenvalues - Eigenvalues of the canonical roots.

    • % - Proportion of explained variance of correlation.

    • Cum % - Cumulative proportion of explained variance of correlation.

    • Cor - Canonical correlation coefficient.

    • Sq. Cor - Squared canonical correlation coefficient.

Arguments

x

A data frame or a matrix with the values that correspond to the first set of variables (\(X\)-variables).

y

A data frame or a matrix with the values that correspond to the second set of variables (\(Y\)-variables).

xcenter

Whether any centring have to be done on the \(x\) values before the analysis. If TRUE (default), subtract the column means. If FALSE, do not adjust the columns. Otherwise, a vector of values to be subtracted from the columns.

ycenter

Analogous to xcenter, but for the \(y\) values.

useCCApackage

Whether cc function (from CCA package) or cancor function (from stats package) should be used to obtain canonical correlations.

Author

Adapted by Aleš Žiberna based on the source in References.

References

R Data Analysis Examples: Canonical Correlation Analysis, UCLA: Statistical Consulting Group. From http://www.ats.ucla.edu/stat/r/dae/canonical.htm (accessed Decembar 27, 2013).

See Also

testCC

Examples

Run this code
cancorPlus(x = mtcars[, c(1,2,3)], y = mtcars[, c(4,5, 6)])

Run the code above in your browser using DataLab