How to Compute Pearson’s Correlation Coefficients
Correlation coefficients are used in statistics to measure how strong a relationship is between two variables. There are several types of correlation coefficient: Pearson’s correlation is a correlation coefficient commonly used in linear regression.
Sample question: compute the value of the correlation coefficient from the following table:
| Subject | Age x | Glucose Level y |
|---|---|---|
| 1 | 43 | 99 |
| 2 | 21 | 65 |
| 3 | 25 | 79 |
| 4 | 42 | 75 |
| 5 | 57 | 87 |
| 6 | 59 | 81 |
Step 1:Make a chart. Use the given data, and add three more columns: xy, x2, and y2.
| Subject | Age x | Glucose Level y | xy | x2 | y2 |
|---|---|---|---|---|---|
| 1 | 43 | 99 | |||
| 2 | 21 | 65 | |||
| 3 | 25 | 79 | |||
| 4 | 42 | 75 | |||
| 5 | 57 | 87 | |||
| 6 | 59 | 81 |
Step 2::Multiply x and y together to fill the xy column. For example, row 1 would be 43 × 99 = 4,257.
| Subject | Age x | Glucose Level y | xy | x2 | y2 |
|---|---|---|---|---|---|
| 1 | 43 | 99 | 4257 | ||
| 2 | 21 | 65 | 1365 | ||
| 3 | 25 | 79 | 1975 | ||
| 4 | 42 | 75 | 3150 | ||
| 5 | 57 | 87 | 4959 | ||
| 6 | 59 | 81 | 4779 |
Step 3: Take the square of the numbers in the x column, and put the result in the x2 column.
| Subject | Age x | Glucose Level y | xy | x2 | y2 |
|---|---|---|---|---|---|
| 1 | 43 | 99 | 4257 | 1849 | |
| 2 | 21 | 65 | 1365 | 441 | |
| 3 | 25 | 79 | 1975 | 625 | |
| 4 | 42 | 75 | 3150 | 1764 | |
| 5 | 57 | 87 | 4959 | 3249 | |
| 6 | 59 | 81 | 4779 | 3481 |
Step 4: Take the square of the numbers in the y column, and put the result in the y2 column.
| Subject | Age x | Glucose Level y | xy | x2 | y2 |
|---|---|---|---|---|---|
| 1 | 43 | 99 | 4257 | 1849 | 9801 |
| 2 | 21 | 65 | 1365 | 441 | 4225 |
| 3 | 25 | 79 | 1975 | 625 | 6241 |
| 4 | 42 | 75 | 3150 | 1764 | 5625 |
| 5 | 57 | 87 | 4959 | 3249 | 7569 |
| 6 | 59 | 81 | 4779 | 3481 | 6561 |
Step 5: Add up all of the numbers in the columns and put the result at the bottom.2 column. The Greek letter sigma (Σ) is a short way of saying “sum of.”
| Subject | Age x | Glucose Level y | xy | x2 | y2 |
|---|---|---|---|---|---|
| 1 | 43 | 99 | 4257 | 1849 | 9801 |
| 2 | 21 | 65 | 1365 | 441 | 4225 |
| 3 | 25 | 79 | 1975 | 625 | 6241 |
| 4 | 42 | 75 | 3150 | 1764 | 5625 |
| 5 | 57 | 87 | 4959 | 3249 | 7569 |
| 6 | 59 | 81 | 4779 | 3481 | 6561 |
| Σ | 247 | 486 | 20485 | 11409 | 40022 |
Step 6:Use the following formula to work out the correlation coefficient.

The answer is: 2826 / 5413.27 = 0.529809
Click here if you want easy, step-by-step instructions for solving this formula.
From our table:
- Σx = 247
- Σy = 486
- Σxy = 20,485
- Σx2 = 11,409
- Σy2 = 40,022
- n is the sample size, in our case = 6
so the correlation coefficient =
- 6(20,485) – (247 × 486) / [ [6(11,409) - (2472)] × [6(40,022) - 4862]]
- 122,910 – 120,042) / [(66,294 - 2472) × (240,132 - 4862)]
- 2,868 / (5,285 × 3,936)
- 2,868 / 20,801,760
- 1.3787 × 10-4
*/ ?>
The range of the correlation coefficient is from -1 to 1. Since our result is 1.3787 × 10-4, a tiny positive amount, we can’t draw any conclusions one way or another.
Related posts:
- How to Test for Correlation Coefficients
- How to Find the Coefficient of Determination
- How to Compute a Linear Regression Test Value
- How to Find a Linear Regression Equation
How to Do Everything Statistics » How to Test for Correlation Coefficient said:
Nov 05, 09 at 10:45 am[...] coefficient. Sample question: test the significance of the correlation coefficient r=0.565 (How to calculate a correlation coefficient) using the critical values for PPMC table. Test at α=0.01 for a sample size of 9. Step 1: [...]
How to Do Everything Statistics » How to Find the Coefficient of Determination said:
Nov 05, 09 at 12:00 pm[...] values. Finding the coefficient of determination takes only three steps! Step 1: Find the correlation coefficient, r (it may be given to you in the question). Example, [...]
How to Do Everything Statistics » How to Find a Linear Regression Equation said:
Nov 05, 09 at 12:38 pm[...] When a correlation coefficient shows that data is likely to be able to predict future outcomes, statisticians use linear regression to find a predictive function. If you recall from elementary algebra, the equation for a line is y=mx+b. This article shows you how to take data, calculate linear regression, and find the equation y’=a+bx. Step 1: Make a chart of your data, filling in the columns in the same way as you would fill in the chart if you were finding the Pearson’s Correlation Coefficient. [...]
Jennifer Thomas said:
Nov 08, 09 at 8:28 pmI’m a little confused. Based on the formula, I thought that instead of squaring 114092 and 40022, you should square x (247)and y (486).
Stephanie said:
Nov 09, 09 at 5:30 amJennifer,
You are completely correct. That was a typo on my part!
Stephanie
Bill Bryan said:
Dec 01, 09 at 11:22 amI think this is the part of the course that you can feel your brain growing larger. The Correlation Coefficient equation is a long process, if only there was a way to shorten the problem.
Donna Allen said:
Dec 02, 09 at 7:42 pmI too wish there was a shorter way to do this problem. I’m just thankful that I actually understand how to work the problem. Your explanation was helpful and easy to follow. Thank you!
Vanessa said:
Dec 03, 09 at 9:57 pmThis example was really helpful and I understand how to calculate the problem and how to do all of the steps but the only problem I am having is how did you get the final answer which in your example it says 1.44281 … in mathzone I did the whole problem like it said and I even saw the example and it was right but the final answer I dont know how they got to. i got 2.14866937 E -4 , but the answer was 0.947. please help me .. im I missing something?
Vanessa said:
Dec 04, 09 at 12:54 amI understand, I just figured out the right answer now. I didnt know I had to square root the bottom part, and even though this helped me alot, i used google and they helped me figure out the last part by explaining everything step by step and unfortunately thats what i need.
Alison Bryant said:
Apr 26, 10 at 12:19 pmI have found that it is easiest, and you get the same answer by going through the Linreg function on the calculator, it gives you the correlation coefficent as well as the correlation of determination.
Tony said:
Apr 07, 11 at 4:10 amExcellent example. A couple of mistakes though! 6×11409 = 68454
Also you must take the square-root of the denominator. I make the answer 0.5298
Ronak said:
Aug 02, 11 at 11:22 amOn this page you showed that r’s denominator is a square root
http://www.statisticshowto.com/articles/how-to-compute-pearsons-correlation-coefficients/
but on this page, you didn’t do it.
http://www.statisticshowto.com/help-with-statistics-equations/
Also, step 5 is wrong.
6 * 11409 = 68,454 not 66,294
In step 7, you used 68,454 which is correct but when you subtracted 61009 from it you got the incorrect value of 5,285.
68,454 – 61,009 = 7,445
In step 11, it becomes 7,445 * 3936 = 29303520.
The final answer should be 2896 / 29303520 = 9.78722e-05 = 0.000097822
Regards,
Ronak said:
Aug 02, 11 at 11:28 amForgot to sqrt the denominator.
sqrt(29303520) = 5413.27
r = 2826 / 5413.27 = 0.529809
Correlation of determination
r^2 = 0.280697
nick bhullar said:
Oct 09, 11 at 6:14 pmyou are absolutely correct
ARCHANA said:
Oct 15, 11 at 4:20 amITS GOOD,EASY TO UNDERSTAND
Stephanie said:
Oct 27, 11 at 9:09 pmThanks for spotting the error in the formula! An update is on the way for the long step from the book. In the meantime, this page has been updated with the correct answer (thanks, Tony!).
Seema Dessai said:
Dec 22, 11 at 9:59 pmThis explanation i personally found to be the best after going through many explanation based on the same formula.Thank you very much for such a simple and understanding method of explanation of Pearson’s Correlation Coefficients.
Statistics How To» Blog Archive » How to Find a Linear Regression Slope said:
Jan 03, 12 at 11:15 am[...] If you don’t remember how to get those variables from data, see this article on how to find a Pearson’s correlation coefficient. Follow the steps there to create a table and find Σx, Σy, Σxy, Σx2, and [...]