slycat.cca

slycat.cca.cca(X, Y, scale_inputs=True, force_positive=None, significant_digits=None)[source]

Compute Canonical Correlation Analysis (CCA).

Parameters:
  • X (numpy.ndarray) – \(M \times I\) matrix containing \(M\) observations and \(I\) input features.
  • Y (numpy.ndarray) – \(M \times O\) matrix containing \(M\) observations and \(O\) output features.
  • scale_inputs (bool, optional) – Scale input and output features to unit variance.
  • force_positive (integer, optional) – If specified, flip signs in the x, y, x_loadings, and y_loadings output values so that the values in row \(n\) of y_loadings are all positive.
  • significant_digits (integer, optional) – Optionally specify the number of significant digits used to compute the X and Y ranks.
Returns:

  • x (numpy.ndarray) – \(M \times C\) matrix containing input metavariable values for \(M\) observations and \(C\) CCA components.
  • y (numpy.ndarray) – \(M \times C\) matrix containing output metavariable values for \(M\) observations and \(C\) CCA components.
  • x_loadings (numpy.ndarray) – \(I \times C\) matrix containing weights for \(I\) input variables and \(C\) CCA components.
  • y_loadings (numpy.ndarray) – \(O \times C\) matrix containing weights for \(O\) output variables and \(C\) CCA components.
  • r2 (numpy.ndarray) – length-\(C\) vector containing \(r^2\) values for \(C\) CCA components.
  • wilks (numpy.ndarray) – length-\(C\) vector containing the likelihood-ratio for \(C\) CCA components.