Computational Provenance & Reproducibility Record

RAISINS - R and AI Solutions for INferential Statistics · Online Statistical Analysis Platform for Agricultural Research

Computational Provenance & Reproducibility Record Canonical Correlation Analysis · 2.0.0 · DOI 10.5281/zenodo.21882155

Computational Provenance & Reproducibility Record

RAISINS · Canonical Correlation Analysis Module

This Computational Provenance Record documents the statistical computing environment, software dependencies, computational provenance, and bibliographic references associated with the RAISINS Canonical Correlation Analysis module. It is intended to support computational reproducibility and software transparency. Detailed statistical methodology, mathematical derivations, and user guidance are provided separately in the official module documentation.

Any issues or updates required please comment here

Go to the App from here

1 Module Metadata

Parameter Specification
Module Canonical Correlation Analysis
Module Version 2.0.0
DOI 10.5281/zenodo.21882155
Document Type Computational workflow
Statistical Engine R
R Version 4.5.2
Reproducibility Execution Environment: Posit Connect · GCR · renv-locked

2 Statistical Dependency Manifest

Package Version Repository Core Statistical Functions
CCA 1.2.2 CRAN cc(), comput()
CCP 1.2 CRAN p.asym()
stats 4.5.2 Base R cor(), na.omit()

3 Statistical Function Registry

Analytical Role Primary Function(s)
Canonical correlation extraction CCA::cc()
Raw canonical coefficients, structure loadings & cross-loadings CCA::comput()
Significance testing (Wilks’ Lambda) CCP::p.asym(tstat = "Wilks")
Canonical variate scores (for plots) CCA::comput()$xscores, $yscores
Structure correlations (biplot / network plots) stats::cor() of each set against the joint canonical scores

4 Default Methods & Parameters

Analysis Step / Parameter Default Method / Value
Canonical
Correlation
Method Canonical correlation between an X-set and a Y-set of numeric variables via CCA::cc(); rows with missing values in any selected column are removed listwise (na.omit()) before fitting
Number of canonical functions min(p, q), where p and q are the number of variables in the X-set and Y-set respectively
Variable requirements At least 2 numeric variables in each of the X-set and Y-set; non-numeric columns in a selected set are dropped before fitting
Significance
Testing
Test Wilks' Lambda, sequential test of function k through min(p,q), via CCP::p.asym(tstat = "Wilks"), using Rao's F-approximation
Significance level User-selectable via a "Level of significance (α)" control; α = 0.05 (default) or 0.01, applied uniformly to all functions
Coefficients
& Loadings
Raw canonical coefficients Standardized coefficients of the linear combinations that define each canonical variate (cc()$xcoef, cc()$ycoef)
Structure loadings & cross-loadings Pearson correlations between each original variable and the canonical variates of its own set (structure loadings) and of the other set (cross-loadings), via comput()
Practical
Retention Rule
Retained for interpretation A canonical function is flagged "Retained" when its Wilks' Lambda p-value is below the selected significance level α (see above) and its r² (squared canonical correlation) ≥ 0.10. A function can be statistically significant yet not retained if it explains too little shared variance to be practically meaningful
Loading
Importance
Threshold A structure or cross-loading with |value| > 0.3 is treated as an important/dominant contributor to that canonical function
Plots Canonical scores, scree, biplot Canonical variate scores from comput()$xscores/$yscores; the biplot's joint observation position is the average of the X-side and Y-side scores on the chosen pair of dimensions
Loadings heatmap, network plot Structure/cross-loading matrices rendered directly; the network plot additionally filters variables by a user-adjustable minimum |loading| threshold

5 R Code for Key Analytical Steps

The code blocks below demonstrate the exact computation behind each reported result, using the built-in mtcars dataset from the datasets package, split into two illustrative variable sets: an engine/performance set and a body/weight set.

5.1 Canonical Correlation

data(mtcars)
X <- mtcars[, c("mpg", "hp", "qsec")]   # performance set
Y <- mtcars[, c("wt", "disp", "drat")]  # body / weight set

cca <- CCA::cc(X, Y)
rho  <- cca$cor     # canonical correlations
rho2 <- rho^2        # r-squared (shared variance) per function

5.2 Significance Testing (Wilks’ Lambda)

n <- nrow(X); p <- ncol(X); q <- ncol(Y)
wilks <- CCP::p.asym(rho, n, p, q, tstat = "Wilks")
# wilks$stat, $approx (F), $df1, $df2, $p.value - one row per function,
# sequentially testing function k through min(p,q)

alpha <- 0.05  # user-selectable in the app: 0.05 (default) or 0.01
retained <- (wilks$p.value < alpha) & (rho2 >= 0.10)  # practical retention rule

5.3 Raw Canonical Coefficients, Loadings and Cross-Loadings

comp <- CCA::comput(X, Y, cca)

cca$xcoef            # raw canonical coefficients, X-set
cca$ycoef            # raw canonical coefficients, Y-set

comp$corr.X.xscores  # structure loadings: X-set vs its own canonical variate (U)
comp$corr.Y.yscores  # structure loadings: Y-set vs its own canonical variate (V)
comp$corr.X.yscores  # cross-loadings: X-set vs the Y-set's canonical variate (V)
comp$corr.Y.xscores  # cross-loadings: Y-set vs the X-set's canonical variate (U)

5.4 Canonical Variate Scores (for Plots)

U <- comp$xscores  # per-observation scores on each X-side canonical variate
V <- comp$yscores  # per-observation scores on each Y-side canonical variate

# the canonical scores plot pairs U and V per function;
# the biplot's joint observation position, for a chosen pair of dimensions
# dim_x, dim_y, is the average of the corresponding U and V columns
joint <- (U[, c("Dim1", "Dim2")] + V[, c("Dim1", "Dim2")]) / 2  # illustrative

Explore the entire Canonical Correlation Analysis module in preview mode using our demo datasets. To submit suggestions or report a workflow issue, please use the discussion section below, or visit the official RAISINS website.

6 RAISINS Native Statistical Framework

RAISINS uses R for all its statistical computations. Every package used to generate major results is listed and demonstrated with examples, so results can be reproduced independently. These results are then organized and formatted on the RAISINS website along with visualisation to make them easier to use and interpret. RAISINS also has its own custom-built statistical tools for managing workflows, validating results, and generating reports. Details of these are not fully covered here, they’re shared with outside researchers only on request, and are subject to licensing terms.

7 Package References

R Core Team. (2025). R: A language and environment for statistical computing. R Foundation for Statistical Computing, Vienna, Austria. https://www.R-project.org/

González, I., Déjean, S., Martin, P. G. P., & Baccini, A. (2008). CCA: An R Package to Extend Canonical Correlation Analysis. Journal of Statistical Software, 23(12), 1-14. https://doi.org/10.18637/jss.v023.i12

Menzel, U. (2012). CCP: Significance Tests for Canonical Correlation Analysis (R package version 1.2). https://CRAN.R-project.org/package=CCP

Hotelling, H. (1936). Relations Between Two Sets of Variates. Biometrika, 28(3/4), 321-377. https://doi.org/10.2307/2333955

Feedback & Discussion