Search tools

Search for a command to run...

Linear Regression & Correlation Calculator

Fit a least-squares line to x,y data: slope, intercept, equation, R², Pearson correlation coefficient r — and predict y for any x.

How to use

  1. 1Enter one x,y pair per line (e.g. '1, 2.1').
  2. 2Optionally enter an x value to predict y.

How it's calculated

Slope b = Σ(x − x̄)(y − ȳ) ÷ Σ(x − x̄)². Intercept a = ȳ − b x̄. r = Σ(x − x̄)(y − ȳ) ÷ √(Σ(x − x̄)² Σ(y − ȳ)²). R² = r².

Frequently asked questions

What does R² tell me?

The share of the variation in y explained by the line. R² = 0.8 means 80% of the variation is explained by x.

What's a strong correlation?

Rough guide: |r| above 0.7 is strong, 0.4–0.7 moderate, below 0.3 weak. Always plot your data too.

Does correlation mean causation?

No — a third factor could drive both, or the relationship could be coincidence.