Here’s the formula of the sample correlation.
We need SPxy (sum of products of X and Y), SSx (sum of squares of X), and SSy (sum of squares of Y).
And here’s a sample data set and the computation of the sample correlation.
The X and Y columns are the given data, X*X is the square of each value of X while Y*Y is the square of each value of Y, and finally the column X*Y is the product of X and Y values.
For next step in computation, we will simply use the sums to substitute the terms in the formula for SPxy, SSx, and SSy. Then finally substitute SPxy, SSx, and SSy in the formula of r. We get r = 0.9733285, a strong and positive correlation between X and Y.
Hope this helps.
The 365 Team