Skip to main content
Skip to main content

corr

Calculates the Pearson correlation coefficient:

Σ(xxˉ)(yyˉ)Σ(xxˉ)2Σ(yyˉ)2\frac{\Sigma{(x - \bar{x})(y - \bar{y})}}{\sqrt{\Sigma{(x - \bar{x})^2} * \Sigma{(y - \bar{y})^2}}}
Note

This function uses a numerically unstable algorithm. If you need numerical stability in calculations, use the corrStable function. It is slower but provides a more accurate result.

Syntax

Arguments

Returned Value

  • The Pearson correlation coefficient. Float64.

Example

Query:

Result: