scippuncertainty.correlation.pearson_correlation#

scippuncertainty.correlation.pearson_correlation(cov)[source]#

Compute the Pearson correlation coefficient from a covariance matrix.

The Pearson correlation coefficient is a measure of linear correlation. Given a variance-covariance matrix \(\Sigma\), it is ddefined as:

\[r_{ij} = \Sigma_{ij} / \sqrt{\Sigma_{ii} \Sigma_{jj}}\]

It is in the range \([-1, 1]\), where 0 means no correlation and -1 and 1 mean full (anti-)correlation. The diagonal is always 1.

Parameters:

cov (TypeVar(T, bound= Variable | DataArray)) – A variance-covariance matrix. Must have exactly 2 dimensions that correspond to rows and columns.

Returns:

TypeVar(T, bound= Variable | DataArray) – The pearson correlation coefficient. Has the same sizes and coords as cov.