# Pearson correlation coefficient

In statistics, the Pearson correlation coefficient (PCC, pronounced /ˈpɪərsən/), also referred to as the Pearson's rPearson product-moment correlation coefficient (PPMCC) or bivariate correlation,[1]is a measure of the linear correlation between two variables X and Y. It has a value between +1 and −1, where 1 is total positive linear correlation, 0 is no linear correlation, and −1 is total negative linear correlation. It is widely used in the sciences. It was developed by Karl Pearson from a related idea introduced by Francis Galton in the 1880s.

## Definition

Pearson's correlation coefficient is the covariance of the two variables divided by the product of their standard deviations. The form of the definition involves a "product moment", that is, the mean (the first moment about the origin) of the product of the mean-adjusted random variables; hence the modifier product-moment in the name.

### For a population

Pearson's correlation coefficient when applied to a population is commonly represented by the Greek letter ρ (rho) and may be referred to as the population correlation coefficient or the population Pearson correlation coefficient. The formula for ρ[5] is:
${\displaystyle \rho _{X,Y}={\frac {\operatorname {cov} (X,Y)}{\sigma _{X}\sigma _{Y}}}}$
where:
• ${\displaystyle \operatorname {cov} }$ is the covariance
• ${\displaystyle \sigma _{X}}$ is the standard deviation of ${\displaystyle X}$
• ${\displaystyle \sigma _{Y}}$ is the standard deviation of ${\displaystyle Y}$
The formula for ρ can be expressed in terms of mean and expectation. Since
${\displaystyle \operatorname {cov} (X,Y)=\operatorname {E} [(X-\mu _{X})(Y-\mu _{Y})]}$[5]
Then the formula for ρ can also be written as
${\displaystyle \rho _{X,Y}={\frac {\operatorname {E} [(X-\mu _{X})(Y-\mu _{Y})]}{\sigma _{X}\sigma _{Y}}}}$
where:
• ${\displaystyle \operatorname {cov} }$ and ${\displaystyle \sigma _{X}}$ are defined as above
• ${\displaystyle \mu _{X}}$ is the mean of ${\displaystyle X}$
• ${\displaystyle \operatorname {E} }$ is the expectation.
The formula for ρ can be expressed in terms of uncentered moments. Since
• ${\displaystyle \mu _{X}=\operatorname {E} [X]}$
• ${\displaystyle \mu _{Y}=\operatorname {E} [Y]}$
• ${\displaystyle \sigma _{X}^{2}=\operatorname {E} [(X-\operatorname {E} [X])^{2}]=\operatorname {E} [X^{2}]-\operatorname {[} {E}[X]]^{2}}$
• ${\displaystyle \sigma _{Y}^{2}=\operatorname {E} [(Y-\operatorname {E} [Y])^{2}]=\operatorname {E} [Y^{2}]-\operatorname {[} {E}[Y]]^{2}}$
• ${\displaystyle \operatorname {E} [(X-\mu _{X})(Y-\mu _{Y})]=\operatorname {E} [(X-\operatorname {E} [X])(Y-\operatorname {E} [Y])]=\operatorname {E} [XY]-\operatorname {E} [X]\operatorname {E} [Y],\,}$
the formula for ρ can also be written as
${\displaystyle \rho _{X,Y}={\frac {\operatorname {E} [XY]-\operatorname {E} [X]\operatorname {E} [Y]}{{\sqrt {\operatorname {E} [X^{2}]-\operatorname {[} {E}[X]]^{2}}}~{\sqrt {\operatorname {E} [Y^{2}]-\operatorname {[} {E}[Y]]^{2}}}}}.}$

### For a sample

Pearson's correlation coefficient when applied to a sample is commonly represented by the letter r and may be referred to as the sample correlation coefficient or the sample Pearson correlation coefficient. We can obtain a formula for r by substituting estimates of the covariances and variances based on a sample into the formula above. So if we have one dataset {x1,...,xn} containing n values and another dataset {y1,...,yn} containing n values then that formula for r is:
${\displaystyle r={\frac {\sum _{i=1}^{n}(x_{i}-{\bar {x}})(y_{i}-{\bar {y}})}{{\sqrt {\sum _{i=1}^{n}(x_{i}-{\bar {x}})^{2}}}{\sqrt {\sum _{i=1}^{n}(y_{i}-{\bar {y}})^{2}}}}}}$
where:
• ${\displaystyle n,x_{i},y_{i}}$ are defined as above
• ${\displaystyle {\bar {x}}={\frac {1}{n}}\sum _{i=1}^{n}x_{i}}$ (the sample mean); and analogously for ${\displaystyle {\bar {y}}}$
Rearranging gives us this formula for r:
${\displaystyle r=r_{xy}={\frac {n\sum x_{i}y_{i}-\sum x_{i}\sum y_{i}}{{\sqrt {n\sum x_{i}^{2}-(\sum x_{i})^{2}}}~{\sqrt {n\sum y_{i}^{2}-(\sum y_{i})^{2}}}}}.}$
where:
• ${\displaystyle n,x_{i},y_{i}}$ are defined as above
• This formula suggests a convenient single-pass algorithm for calculating sample correlations, but, depending on the numbers involved, it can sometimes be numerically unstable.
Rearranging again gives us this[5] formula for r:
${\displaystyle r=r_{xy}={\frac {\sum x_{i}y_{i}-n{\bar {x}}{\bar {y}}}{{\sqrt {(\sum x_{i}^{2}-n{\bar {x}}^{2})}}~{\sqrt {(\sum y_{i}^{2}-n{\bar {y}}^{2})}}}}.}$
where:
• ${\displaystyle n,x_{i},y_{i},{\bar {x}},{\bar {y}}}$ are defined as above
An equivalent expression gives the formula for r as the mean of the products of the standard scores as follows:
${\displaystyle r=r_{xy}={\frac {1}{n-1}}\sum _{i=1}^{n}\left({\frac {x_{i}-{\bar {x}}}{s_{x}}}\right)\left({\frac {y_{i}-{\bar {y}}}{s_{y}}}\right)}$
where
• ${\displaystyle n,x_{i},y_{i},{\bar {x}},{\bar {y}}}$ are defined as above, and ${\displaystyle s_{x},s_{y}}$ are defined below
• ${\displaystyle \left({\frac {x_{i}-{\bar {x}}}{s_{x}}}\right)}$ is the standard score (and analogously for the standard score of y)
Alternative formulae for r are also available. One can use the following formula for r:
${\displaystyle r=r_{xy}={\frac {\sum x_{i}y_{i}-n{\bar {x}}{\bar {y}}}{(n-1)s_{x}s_{y}}}}$
where:
• ${\displaystyle n,x_{i},y_{i},{\bar {x}},{\bar {y}}}$ are defined as above and:
• ${\displaystyle s_{x}={\sqrt {{\frac {1}{n-1}}\sum _{i=1}^{n}(x_{i}-{\bar {x}})^{2}}}}$ (the sample standard deviation); and analogously for sy
Practical issues
Under heavy noise conditions, extracting the correlation coefficient between two sets of stochastic variables is nontrivial, in particular where Canonical Correlation Analysis reports on degraded correlation values due to the heavy noise contributions. A generalization of the approach is given elsewhere.[6]
In case of missing data, Garren derived the maximum likelihood estimator.[7]

## Interpretation

The correlation coefficient ranges from −1 to 1. A value of 1 implies that a linear equation describes the relationship between X and Y perfectly, with all data points lying on a line for which Y increases as Xincreases. A value of −1 implies that all data points lie on a line for which Y decreases as X increases. A value of 0 implies that there is no linear correlation between the variables.
More generally, note that (Xi − X)(Yi − Y) is positive if and only if Xi and Yi lie on the same side of their respective means. Thus the correlation coefficient is positive if Xi and Yi tend to be simultaneously greater than, or simultaneously less than, their respective means. The correlation coefficient is negative (anti-correlation) if Xi and Yi tend to lie on opposite sides of their respective means. Moreover, the stronger is either tendency, the larger is the absolute value of the correlation coefficient.
Rogers and Nicewander [8] cataloged thirteen ways of interpreting covariance:
• Function of raw scores and means
• Standardized covariance
• Standardized slope of the regression line
• Geometric mean of the two regression slopes
• Square root of the ratio of two variances
• Mean cross-product of standardized variables
• Function of the angle between two standardized regression lines
• Function of the angle between two variable vectors
• Rescaled variance of the difference between standardized scores
• Estimated from the balloon rule
• Related to the bivariate ellipses of isoconcentration
• Function of test statistics from designed experiments
• Ratio of two means
Blogger Widgets