skbio.stats.ordination.corr

skbio.stats.ordination.corr(x, y=None)[source]

Computes correlation between columns of x, or x and y.

State: Experimental as of 0.4.0.

Correlation is covariance of (columnwise) standardized matrices, so each matrix is first centered and scaled to have variance one, and then their covariance is computed.

Parameters:
  • x (2D array_like) – Matrix of shape (n, p). Correlation between its columns will be computed.
  • y (2D array_like, optional) – Matrix of shape (n, q). If provided, the correlation is computed between the columns of x and the columns of y. Else, it’s computed between the columns of x.
Returns:

Matrix of computed correlations. Has shape (p, p) if y is not provided, else has shape (p, q).

Return type:

correlation