CalcDepo

Linear Regression Calculator

Fit a least-squares line and predict y.

Inputs

Results

Slope2.02
Intercept-0.02
RΒ²0.9982107
Predicted y14.12

Chart

Not what you need? Search by intent

Describe what you want to find β€” β€œline of best fit” β€” and jump to the right calculator.

How to use the linear regression calculator

Fit a least-squares line and predict y. Enter x values, y values, predict at x in the fields above; the slope, intercept, rΒ², predicted y are computed instantly and plotted on the chart so you can see how the answer changes.

Formula

Slope = slope(x,y)
Intercept = icpt(x,y)
RΒ² = corr(x,y)^2
Predicted y = [Intercept]+[Slope] Γ— xp

Variables

  • x β€” X values
  • y β€” Y values
  • xp β€” Predict at x

Worked example

With x values = 1,2,3,4,5,6, y values = 2.1,3.9,6.2,7.8,10.1,12.2, predict at x = 7, the calculator gives slope β‰ˆ 2.02; intercept β‰ˆ -0.02; rΒ² β‰ˆ 0.9982107; predicted y β‰ˆ 14.12.

Frequently asked questions

What is the formula for the linear regression calculation?

Slope = slope(x,y). Intercept = icpt(x,y). RΒ² = corr(x,y)^2. Predicted y = [Intercept]+[Slope] Γ— xp. Here x is x values, y is y values, xp is predict at x.

What inputs do I need for the linear regression calculator?

You need x values, y values, predict at x. Each field is pre-filled with a typical example so you can see how the result responds as you edit the numbers.

How do I use this calculator?

Type values into the input fields. Results and the chart update instantly. Use Reset to restore the example values, Copy results to paste them elsewhere, or Share to copy a link that preserves your inputs.

Is the result exact?

Calculations use standard formulas and double-precision arithmetic, then display about seven significant figures. Real-world measurements carry uncertainty, so treat results as estimates unless your inputs are exact.

Related calculators

More in Statistics & Probability: Mean, Median and Mode Β· Standard Deviation Β· Quartiles and IQR Β· Percentile Β· Z-Score Β· Normal Distribution Probability Β· Inverse Normal Β· Binomial Probability