# Pearson Correlation Formula

The name correlation suggests the relationship between two variables as their Co-relation. The correlation coefficient is the measurement of correlation. To see how the two sets of data are connected, we make use of this formula. The linear dependency between the data set is done by the Pearson Correlation coefficient. It is also known as Pearson product moment correlation coefficient. The value of the Pearson correlation coefficient product is between -1 to +1.  When the correlation coefficient comes down to zero, then the data is said to be not related. While, if we are getting the value of +1, then the data are positively correlated and -1 has a negative correlation.

The graphical representation of positive, negative and no correlation is shown below:

Positive Correlation

For using the sample data, the Pearson correlation coefficient is denoted by the letter “r”. The formula for Pearson correlation coefficient r is given by:

$\large r=\frac{n(\sum xy)-(\sum x)(\sum y)}{\sqrt{[n\sum x^{2}-(\sum x)^{2}][n\sum y^{2}-(\sum y)^{2}]}}$

Where,
r = Pearson correlation coefficient
x = Values in the first set of data
y = Values in the second set of data
n = Total number of values.

Solved Examples

Question: Marks obtained by 5 students in algebra and trigonometry as given below:

 Algebra 15 16 12 10 8 Trigonometry 18 11 10 20 17

Calculate the Pearson correlation coefficient?

Solution:

Construct the following table:

 x y x2 y2 xy 15 18 225 324 270 16 11 256 121 176 12 10 144 100 120 10 20 100 400 200 8 17 64 289 136 $\sum x$ = 61 $\sum y$ = 76 $\sum x^{2}$ = 789 $\sum y^{2}$ = 1234 $\sum xy$ = 902

Formula for Pearson correlation coefficient is given by:

r = $\frac{n(\sum xy)-(\sum x)(\sum y)}{\sqrt{[n\sum x^{2}-(\sum x)^{2}] [n\sum y^{2}-left (\sum y )^{2}]}}$

r = $\frac{5 \times 902 – 61 \times 76}{\sqrt{[ 5 \times 789 – (61)^{2}][ 5 \times 1234 – (76)^{2}]}}$

r = -0.424