Least Squares Regression Line Calculator

Fit a line to paired data, find R², and predict y at a chosen x.

Enter your values

Separate values with spaces, commas, or new lines.

Separate values with spaces, commas, or new lines.

Result

8.5
Result represents
Predicted y
Slope
1.7
Y-intercept
-7.77156117238E-16
Coefficient of determination (R²)
0.979661016949
Regression equation
y = 1.7x − 7.77156117238E-16
Need help with your result? Ask a question about your inputs or calculation. Ask AI
0 / 2000
20 requests per day · resets at 00:00 UTC

When to use Least Squares Regression Line Calculator

Fit a line to paired data, find R², and predict y at a chosen x.

Summarize data or explore a probability model before interpreting the result in its original context.

How to use this tool

  1. Enter the inputs listed below. Follow the field format, and select units beside each supported quantity.
  2. Results update automatically. Review the main result and its breakdown. Use Clear to enter a new scenario.
  • Observed x values — Separate values with spaces, commas, or new lines.
  • Observed y values — Separate values with spaces, commas, or new lines.
  • Prediction x

How it works

Fit y = mx + b by minimizing the sum of squared vertical residuals. The coefficient of determination R² is undefined when all observed y values are equal.

Worked example

The examples below use fixed sample inputs. They explain the calculation and do not change when you edit the tool above.

Observed x values
1 2 3 4
Observed y values
2 3 5 7
Prediction x
5
Result
8.5
Result represents
Predicted y
Slope
1.7
Y-intercept
-7.77156117238E-16
Coefficient of determination (R²)
0.979661016949
Regression equation
y = 1.7x − 7.77156117238E-16

Understanding the result and its limits

Check sample versus population conventions and model assumptions. A numerical association or interval alone does not establish causation.

Frequently asked questions

Can two summaries of the same data disagree?

Yes. Different definitions, weights and treatment of outliers answer different questions. Compare methods as well as the displayed number.

Methodology and references

Use the formulas and assumptions above when interpreting the example. Any practical estimate depends on the accuracy of the inputs.