MathorynMathematical Formula Database

Statistics & Probability

Pearson Correlation Coefficient

The Pearson correlation coefficient measures the strength and direction of a linear relationship between two variables. It lies between −1-1 and 11; values near ±1\pm1 indicate a strong linear relationship.

r=∑(xi−xˉ)(yi−yˉ)∑(xi−xˉ)2 ∑(yi−yˉ)2r=\frac{\sum(x_i-\bar x)(y_i-\bar y)}{\sqrt{\sum(x_i-\bar x)^2\,\sum(y_i-\bar y)^2}}
LaTeXr=\frac{\sum(x_i-\bar x)(y_i-\bar y)}{\sqrt{\sum(x_i-\bar x)^2\,\sum(y_i-\bar y)^2}}

Variables

rr
correlation coefficient
xˉ, yˉ\bar x,\ \bar y
means of the two variables

Example

Data x=1,2,3x=1,2,3 and y=2,4,5y=2,4,5.

  1. xˉ=2, yˉ=113\bar x=2,\ \bar y=\frac{11}{3}.
  2. ∑(x−xˉ)(y−yˉ)=3\sum(x-\bar x)(y-\bar y)=3, ∑(x−xˉ)2=2\sum(x-\bar x)^2=2, ∑(y−yˉ)2=143\sum(y-\bar y)^2=\frac{14}{3}.
  3. r=328/3r=\frac{3}{\sqrt{28/3}}.

Answer: r≈0.982r\approx0.982.

Related formulas