Correlation in this visualization
The correlation coefficient of paired data, also called Pearson's correlation coefficient, measures how closely the points follow one straight line: it runs from −1 to 1, positive when and tend to rise together. Here each point and the center of the data bound a rectangle whose sides are measured in standard deviations, and is their signed areas added up and divided by . You can drag, add and delete points, load Anscombe's four data sets or a cloud made with a chosen , and see the squares that keep between −1 and 1.
What does measure? In standard units, says how many standard deviations a point lies to the right of the mean of , and how many above the mean of . The rectangle between the point and the center has area ; it counts as positive in the upper right and lower left, where both coordinates are on the same side of their means, and as negative in the other two corners. Because the sides are in standard deviations, changing units or swapping and leaves unchanged. The plot is drawn the same way: one standard deviation is equally long on both axes, so the dashed box is a square and its upper right quarter is one unit of area.
Why can never pass ±1? Draw the line through the center. A point's squared distance from it is , and these squares added up and divided by give exactly , because the and the each add up to . Across the other diagonal, , the same sum gives . Squares are never negative, so , and only when every square across vanishes: all the points lie on one rising line.
Why can the same come from very different pictures? adds up rectangles and never looks at the shape. The statistician Francis Anscombe built four data sets in 1973 with nearly the same , means and fitted line: one is a straight band, one a smooth curve, one follows a nearly straight line apart from an outlier, and one has a single point carrying most of the signed sum. A rectangle grows with the product of a point's two distances from the center, so one far point can supply most of the total area. And points exactly on a parabola can have when they are placed symmetrically: each rectangle on one side is cancelled by its mirror image on the other. measures straight-line association only.
Why look at it in standard units? The eye judges correlation by how thin the cloud looks, and that depends on the axes: stretch one and the same points look thinner or rounder. In experiments by Cleveland, Diaconis and McGill (1982), people judged the same scatter plots as more strongly correlated when the scales were enlarged around them. Standard units make the two axes comparable, one standard deviation equally long on both, and in that picture the cloud's spread across the two diagonals is exactly what measures. They do not make the eye reliable: zoomed out, the same cloud still looks tighter.
Things to notice
- A strong correlation does not show that one variable causes the other: both may follow a third.
- is the cosine of the angle between the centered data vectors and .
- A cloud made from has exactly that correlation by construction; random samples would vary around it.
Controls
- Moving one point can change the center and the standard deviations of the whole cloud, so even points you did not touch can move on the screen.