
Aneesh C. answered 12/29/20
M.S in Public Health with Emphasis on Biostatistics
Hi Ariana!
These are the steps to calculate the correlation coefficient r :
- Calculate the following values (these values will be used for the calculations in the next steps) :
- Calculate x̄, the mean of all of the first coordinates of the data xi.
- Calculate ȳ, the mean of all of the second coordinates of the data yi.
- Calculate s x the sample standard deviation of all of the first coordinates of the data xi.
- Calculate s y the sample standard deviation of all of the second coordinates of the data yi.
- Use the formula (zx)i = (xi – x̄) / s x and calculate a standardized value for each xi.
- Use the formula (zy)i = (yi – ȳ) / s y and calculate a standardized value for each yi.
- Multiply corresponding standardized values: (zx)i(zy)i
- Add the products from the last step together.
- Divide the sum from the previous step by n – 1, where n is the total number of points in our set of paired data. The result of all of this is the correlation coefficient r.
In your example, here is how r is calculated:
x̄ = (2 + 3 + 4) / 3 = 3
ȳ = (3 + 4 + 8) / 3 = 5
sx = [(2 - 3)2 + (3 - 3)2 + (4 - 3)2] / (3 - 1) = 1 --> sqrt(1) = 1
sy = [(3 - 5)2 + (4 - 5)2 + (8 - 5)2] / (3 - 1) = 7 --> sqrt(7) ~ 2.65
zx standardized value for data point (2,3): -1
zx standardized value for data point (3,4): 0
zx standardized value for data point (4,8): 1
zy standardized value for data point (2,3): -0.75
zy standardized value for data point (3,4): -0.34
zy standardized value for data point (4,8): 1.13
Multiplication of corresponding standardized values (zx)i(zy):
- For data point (2,3): 0.75
- For data point (3,4): 0
- For data point (4,8): 1.13
_____________________________________________________________
CORRELATION COEFFICIENT (r): (0.75 + 0 + 1.13) / (3 - 1) = 0.94
P.S you can also use Google to look up a correlation coefficient calculator, where you can plug in your three data points and it gives you the correlation coefficient. I tried doing this and it also gave me r = 0.94 :)