skbio.stats.ordination.corr#

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

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

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:
x2D array_like

Matrix of shape (n, p). Correlation between its columns will be computed.

y2D 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:
correlation

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