Correlation Coefficient (Pearson r)
Statistics
Intro: We compute Pearson’s r to measure linear association.
Worked example
- x:1 2 3 4 5; y:2 3 5 6 8
- Goal: Compute Pearson's correlation $r=\dfrac{\sum (x_i-\bar{x})(y_i-\bar{y})}{\sqrt{\sum (x_i-\bar{x})^2\,\sum (y_i-\bar{y})^2}}$.
- Means: $\bar{x}=\tfrac{1+2+3+4+5}{5}=3$, $\;\bar{y}=\tfrac{2+3+5+6+8}{5}=\tfrac{24}{5}=4.8$.
- Deviations: $(x_i-\bar{x})=(-2,-1,0,1,2)$; $(y_i-\bar{y})=(-2.8,-1.8,0.2,1.2,3.2)$.
- $S_{xx}=\sum (x_i-\bar{x})^2=(-2)^2+(-1)^2+0^2+1^2+2^2=4+1+0+1+4=10$.
- $S_{yy}=\sum (y_i-\bar{y})^2=(-2.8)^2+(-1.8)^2+0.2^2+1.2^2+3.2^2=7.84+3.24+0.04+1.44+10.24=22.80$.
- $S_{xy}=\sum (x_i-\bar{x})(y_i-\bar{y})=(-2)(-2.8)+(-1)(-1.8)+0(0.2)+1(1.2)+2(3.2)=5.6+1.8+0+1.2+6.4=15.0$.
- Correlation: $\displaystyle r=\dfrac{S_{xy}}{\sqrt{S_{xx}S_{yy}}}=\dfrac{15.0}{\sqrt{10\cdot22.80}}=\dfrac{15.0}{\sqrt{228}}\approx\dfrac{15.0}{15.0997}=0.993$.
- Answer: $\boxed{r\approx0.993\;\text{(very strong positive)}}$.
FAQs
Units matter?
No—r is unitless and invariant to linear rescaling.
Why choose MathGPT?
- Get clear, step-by-step solutions that explain the “why,” not just the answer.
- See the rules used at each step (power, product, quotient, chain, and more).
- Optional animated walk-throughs to make tricky ideas click faster.
- Clean LaTeX rendering for notes, homework, and study guides.
How this calculator works
- Type or paste your function (LaTeX like
\sin,\lnworks too). - Press Generate a practice question button to generate the derivative and the full reasoning.
- Review each step to understand which rule was applied and why.
- Practice with similar problems to lock in the method.