Description Usage Arguments Value
Sightly quicker than stats::cancor, and allows you to easily fit cca models in one dataset and find predicted variates/canonical correlations in another dataset.
The number of predictor (X) and outcome (Y) variables are denoted by P1 and P2 below, and N is sample size.
The function also allows the user to rotate the raw coefficients using Procrustes Analyses to target matrices (ProcrustX & ProcrustY), prior to estimating variates.
1 2 3 4 5 6 7 8 9 10 |
X_FIT |
Numeric Matrix [N, P1] containing the training dataset predictor variables. |
Y_FIT |
Numeric Matrix [N, P2] containing the training dataset outcome variables. |
X_PRED |
Numeric Matrix [N, P1] containing the testing dataset predictor variables. Variables should be ordered in the same way as for X_FIT. |
Y_PRED |
Numeric Matrix [N, P2] containing the testing dataset outcome variables. Variables should be ordered in the same way as for Y_FIT. |
ncomp |
Numeric Scalar. Number of CCA components to keep in analyses. Must be equal to or less than min(P1,P2). |
ProcrustX |
Numeric Matrix [ncomp, P1] containing target matrix for Procrustes Analysis. Will align raw coefficient matrix to ProcrustX target matrix. |
ProcrustY |
Numeric Matrix [ncomp, P2] containing target matrix for Procrustes Analysis. Will align raw coefficient matrix to ProcrustY target matrix. |
SafetyChecks |
Checks the input provided for mistakes (default = FALSE). |
A list containing the following components
xcoef - Estimated raw coefficients (CCA weights) for the x (predictor) variables.
ycoef - Estimated raw coefficients (CCA weights) for the y (outcome) variables.
variates - Variates (latent variable scores), estimated from the raw coefficient in X_FIT/Y_FIT. cbind.data.frame(xvariates, yvariates). If X_PRED and Y_PRED are provided, then variates (and xvariates/yvariates) will be the predicted latent variable scores from X_PRED/Y_PRED matrices.
xvariates - Variates (latent variable scores) for predictor variables.
yvariates - Variates (latent variable scores) for outcome variables.
cc_pred - Predicted Canonical Correlations, estimated using from X_PRED & Y_PRED if provided. If no PRED matrices are specified, then this simply returns the estimated canonical correlations from the training datsets (X_FIT/Y_FIT).
cc_fit - Estimated Canonical Correlation estimated from the training datasets (X_FIT/Y_FIT).
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.