Mathematics

Linear Regression Calculator

Fit a least-squares line to x;y pairs, calculate R² and predict y for a chosen x.

01Input and settings

The calculation runs in your browser. You can use the tool without installing software.

02Result

Waiting for input
Waiting for input

Enter your values or load the example to see the result here.

About this tool: Linear Regression Calculator

Fit a least-squares line to x;y pairs, calculate R² and predict y for a chosen x.

Enter one x;y observation per line, using a semicolon or whitespace between values. Least squares minimizes squared vertical residuals. R² describes the fit within your supplied data and does not prove causation; extrapolation outside the observed range can be unreliable.

How the calculation works

y = m x + b; m = Σ((x−x̄)(y−ȳ)) / Σ((x−x̄)²)

Worked example

Pairs: x; y, one per line
1;2
2;4
3;6
Predict for x
4
m = 2; b = 0; R² = 1; y(4) = 8

Questions and answers

What does this tool do?

Fit a least-squares line to x;y pairs, calculate R² and predict y for a chosen x. Enter one x;y observation per line, using a semicolon or whitespace between values. Least squares minimizes squared vertical residuals. R² describes the fit within your supplied data and does not prove causation; extrapolation outside the observed range can be unreliable.

What affects precision and input format?

Floating-point results are rounded for display. Keep the units shown in the input labels; decimal points and decimal commas are accepted.

Where are the calculations performed?

The calculation runs in your browser. You can use the tool without installing software.

Comments (0)

Share your thoughts — please be polite and stay on topic.

No comments yet. Leave a comment — share your opinion!

To leave a comment, please log in.

Log in to comment