Formula
Pearson correlation divides the paired deviations by the spread of each list:
r = sum((x − mean x)(y − mean y)) / √(sum of x squares × sum of y squares)
1 is a perfect positive line. -1 is a perfect negative line. 0 is no straight-line association.
Assumptions
- Each x has a matching y.
- Both lists vary.
Worked example
X values 1, 2, 3, 4 and Y values 2, 4, 6, 8 have correlation 1.
Input definitions
- X values
- The first number in each pair.
- Y values
- The matching second number, in the same order.
Limitations
Correlation is not a cause. A curved relationship can have a correlation near zero.
Questions
What does 1 mean?
The pairs sit on a straight line that rises together.
Why are identical x values rejected?
If x never changes, a straight-line correlation is undefined.