Experiments to try

  1. One point can flip a conclusion. Click Positive trend and note the slope and R². Then click Add an outlier. A single point far from the others, especially far out along the x-axis, drags the line toward itself and lowers R². Remove it by clicking it.
  2. No pattern, no fit. Click Random cloud. The line still exists, because least squares always produces one, but R² is near 0: x tells you almost nothing about y.
  3. A strong pattern with r near zero. Click Clear and place points in a U shape: high on the left, low in the middle, high on the right. The relationship is obvious, yet r and the slope are close to 0, because correlation and simple regression only measure straight-line association.
  4. Two groups make a fake trend. Place a small cluster of points at the bottom left and another at the top right, with no trend inside either cluster. The line and R² suggest a strong relationship that is really just the difference between the two groups.

The lesson behind all four: always plot your data before trusting a regression line or a correlation coefficient.

Guide: Least-Squares Regression

It's the straight line that minimises the total squared vertical distance from the points to the line — the least-squares line. Its slope tells you how much y changes per unit of x, and its intercept is the predicted y when x = 0. This playground computes it live as you add points.

R² is the proportion of the variation in y that the line explains — from 0 (the line tells you nothing) to 1 (a perfect fit). It's the square of the correlation r. Scatter your points randomly and R² collapses toward 0; line them up and it approaches 1.

Because least-squares minimises squared distances, a point far from the rest contributes a huge squared error and pulls the line toward itself — especially if it's far out along the x-axis (high leverage). Add an outlier here and watch the slope and R² change dramatically. It's a vivid reminder to always plot your data before trusting a regression.

No. A high R² means the line predicts y well from x in this data — not that x causes y. See correlation vs causation.

Related Tools

Linear Regression Calculator Correlation Calculator Guess the Correlation More interactive tools