CCorA {vegan} | R Documentation |

Canonical correlation analysis, following Brian McArdle's unpublished graduate course notes, plus improvements to allow the calculations in the case of very sparse and collinear matrices.

CCorA(Y, X, stand.Y=FALSE, stand.X=FALSE, nperm = 0, ...) ## S3 method for class 'CCorA': biplot(x, xlabs, which = 1:2, ...)

`Y` |
left matrix. |

`X` |
right matrix. |

`stand.Y` |
logical; should `Y` be standardized? |

`stand.X` |
logical; should `X` be standardized? |

`nperm` |
numeric; Number of permutations to evaluate the significance of Pillai's trace |

`x` |
`CCoaR` result object |

`xlabs` |
Row labels. The default is to use row names, `NULL`
uses row numbers instead, and `NA` suppresses plotting row names
completely |

`which` |
`1` plots `Y` results, and
`2` plots `X1` results |

`...` |
Other arguments passed to functions. `biplot.CCorA`
passes graphical arguments to `biplot` and
`biplot.default` , `CCorA` currently ignores extra
arguments. |

Canonical correlation analysis (Hotelling 1936) seeks linear
combinations of the variables of `Y`

that are maximally
correlated to linear combinations of the variables of `X`

. The
analysis estimates the relationships and displays them in graphs.

Algorithmic notes:

- All data matrices are replaced by their PCA object scores, computed by SVD.
- The blunt approach would be to read the three matrices, compute the
covariance matrices, then the matrix
`S12 %*% inv(S22) %*% t(S12) %*% inv(S11)`

. Its trace is Pillai's trace statistic. - This approach may fail, however, when there is heavy multicollinearity in very sparse data matrices, as it is the case in 4th-corner inflated data matrices for example. The safe approach is to replace all data matrices by their PCA object scores.
- Inversion by
`solve`

is avoided. Computation of inverses is done by SVD (`svd`

) in most cases. - Regression by OLS is also avoided. Regression residuals are
computed by QR decomposition (
`qr`

).

The `biplot`

function can produce two biplots, each for the left
matrix and right matrix solutions. The function passes all arguments to
`biplot.default`

, and you should consult its help page for
configuring biplots.

Function `CCorA`

returns a list containing the following components:

` Pillai ` |
Pillai's trace statistic = sum of canonical eigenvalues. |

` EigenValues ` |
Canonical eigenvalues. They are the squares of the canonical correlations. |

` CanCorr ` |
Canonical correlations. |

` Mat.ranks ` |
Ranks of matrices `Y` and X1 (possibly after
controlling for X2). |

` RDA.Rsquares ` |
Bimultivariate redundancy coefficients (R-squares) of RDAs of Y|X1 and X1|Y. |

` RDA.adj.Rsq ` |
`RDA.Rsquares` adjusted for n and number of
explanatory variables. |

` AA ` |
Scores of Y variables in Y biplot. |

` BB ` |
Scores of X1 variables in X1 biplot. |

` Cy ` |
Object scores in Y biplot. |

` Cx ` |
Object scores in X1 biplot. |

Pierre Legendre, Departement de Sciences Biologiques, Universite de Montreal. Implemented in vegan with the help of Jari Oksanen.

Hotelling, H. 1936. Relations between two sets of
variates. *Biometrika* **28**: 321-377.

# Example using random numbers mat1 <- matrix(rnorm(60),20,3) mat2 <- matrix(rnorm(100),20,5) CCorA(mat1, mat2) # Example using intercountry life-cycle savings data, 50 countries data(LifeCycleSavings) pop <- LifeCycleSavings[, 2:3] oec <- LifeCycleSavings[, -(2:3)] out <- CCorA(pop, oec) out biplot(out, xlabs = NA)

[Package *vegan* version 1.16-32 Index]