LeoMath

Explore

Correlation is the cosine of an angle

One die roll, six outcomes, each giving a point (X, Y). Drag the points: the covariance is the average signed area of the rectangles; with the means removed, X and Y are two vectors, and the correlation is the cosine of the angle between them.

  • outcome ω (probability 1/6 each)
  • mean (EX, EY)
  • best line
  • product > 0
  • product < 0

Scatter: each outcome ω is a point (X(ω), Y(ω))

Vectors: X and Y with their means removed

  • X − EX
  • Y − EY
  • projection
  • sum (X+Y) − E(X+Y)
EX
−0.17
EY
0.17
σX
2.05
σY
1.18
Cov(X,Y)
1.99
ρ = cos θ
0.82
θ
34.9°
Var(X+Y)
9.58
Cov⁡(X,Y)=E[(X−EX)(Y−EY)]ρ=Cov⁡(X,Y)σXσY=cos⁡θVar⁡(X+Y)=σX2+σY2+2Cov⁡(X,Y)
Arrow keys move
Back to the article →

What did you observe?Play first, then answer. Read the explanation only after you have thought it through.

  1. 1.Press “On a line”. What are ρ and the angle θ? Now drag point 6 down, off the line. How does ρ change? Can any drag push ρ outside [−1, 1]?
  2. 2.Press “Uncorrelated, yet related”. Here Y is completely determined by X, yet Cov is 0. How do the positive and negative areas on the left cancel?
  3. 3.Press “One outlier” and note ρ; then drag point 6 to (0, 0). What does ρ become? Why can one point matter so much?
Related concept: Mean & variance

Discussion

Found a mistake, have a question or a suggestion? You can also write to 620026600@qq.com

No comments yet. Share your understanding, ask a question, or point out an error on this page.

Log in to join the discussion