Least Squares Regression Line Equation Calculator

Enter paired data to calculate the least squares line, correlation, predictions, residuals, confidence intervals, charts, and detailed regression statistics instantly online with clear steps.

Enter Paired Data

Used for interpolation or extrapolation.
Row x y Action
1
2
3
4
5
6
Accepts commas, tabs, semicolons, or spaces between each pair.
The first two numeric columns are used.

Calculation and Display Options

Formula Used

Regression line: ŷ = b₀ + b₁x
Slope: b₁ = [nΣxy − (Σx)(Σy)] ÷ [nΣx² − (Σx)²]
Intercept: b₀ = ȳ − b₁x̄
Correlation: r = [nΣxy − (Σx)(Σy)] ÷ √{[nΣx² − (Σx)²][nΣy² − (Σy)²]}
Coefficient of determination: R² = r²
Residual: eᵢ = yᵢ − ŷᵢ

How to Use This Calculator

  1. Enter paired x and y values in matching rows.
  2. Add rows or paste values from a spreadsheet.
  3. Choose precision, confidence, and equation display options.
  4. Enter an optional x-value for a prediction.
  5. Select Calculate Regression to generate all results.
  6. Review the equation, charts, residuals, and statistical tests.
  7. Copy, print, or download the results as needed.

Example Data

Study HoursExam ScoreExpected Use
152Observed point
255Observed point
361Observed point
466Observed point
572Observed point
678Observed point

Understanding the Results

The slope describes the expected y-change for each x-unit. Its sign shows the relationship direction. Large absolute slopes indicate faster predicted change.

The intercept estimates y when x equals zero. It may lack practical meaning outside observed data. Always consider the measured data range carefully.

R² measures the variation explained by the fitted line. Values nearer one indicate stronger linear fit. Correlation still does not establish causal relationships.

Residuals compare observed and predicted y-values. Random residual patterns support a linear model. Structured patterns may suggest another model fits better.

Frequently Asked Questions

What is a least-squares regression line?

It is the line minimizing squared vertical residuals. It summarizes a linear relationship between paired variables. The method balances positive and negative errors.

How is the regression slope calculated?

The slope uses covariance divided by x variation. It measures predicted y-change per x-unit. A negative result indicates an inverse relationship.

What does the regression intercept mean?

The intercept is predicted y when x equals zero. This value may be outside observed data. Interpret it only when zero is meaningful.

What does R² measure?

R² measures explained variation in the response variable. Higher values indicate closer linear agreement. It does not prove the model is appropriate.

What is a residual?

A residual equals observed y minus predicted y. Positive residuals sit above the fitted line. Negative residuals sit below the fitted line.

Can this calculator predict future values?

It predicts y from any entered x-value. Predictions inside the sample range are interpolations. Outside predictions require stronger caution and assumptions.

What happens when all x-values are equal?

The regression slope becomes undefined without x variation. No unique nonvertical least-squares line exists. Enter at least two distinct x-values.

How do outliers affect the regression equation?

Outliers can strongly alter slope and intercept estimates. High-leverage points may dominate the fitted line. Review residuals and the scatter plot carefully.

Does a strong correlation prove causation?

No, correlation only describes statistical association between variables. Confounding factors may explain the observed relationship. Controlled evidence is needed for causal conclusions.

Related Calculators

Average Calculator StatisticsGeometric Mean CalculatorInter Quartile Range CalculatorLower Quartile CalculatorMaximum CalculatorMean Calculator StatisticsMedian Calculator StatisticsMidhinge Calculator StatisticsMid Range Calculator StatisticsMinimum Calculator Statistics

Important Note: All the Calculators listed in this site are for educational purpose only and we do not guarentee the accuracy of results. Please do consult with other sources as well.