Skip to content

Statistics · free · no sign-up

Regression calculator

Fit a straight line to your data with linear regression, and predict Y for a new X.

How it works Report a problem

Regression Navigator

Least Squares Predictive Analytics Engine

About the Regression calculator

Fit a straight line to your data with linear regression, and predict Y for a new X.

How to use the Regression calculator

  1. Enter the X Dataset and Y Dataset as comma-separated lists of equal length.
  2. Enter an X Value to predict.
  3. Press Calculate to see the line equation, R² and the Predicted Y.

Formula and method

The best-fit line is y = a + b·x with slope b = Σ(x − x̄)(y − ȳ) ÷ Σ(x − x̄)² and intercept a = ȳ − b·x̄.

Worked example

X = 1, 2, 3, 4, 5 and Y = 2, 4, 6, 8, 10 give y = 2x, and predict Y = 14 for X = 7.

Tips

  • Check the scatter of your data before trusting a straight line.
  • Predicting far outside your data range is unreliable.

Frequently asked questions

What is R²?
The share of the variation in Y explained by the line. Closer to 1 means a better fit.