Simple Linear Regression

Fit a straight line between one predictor (X) and a response (Y): the equation, how much of the variation it explains, whether the slope is real, and the residual checks.

More than one predictor? Multiple Regression

Model
Predict at
Optional: enter predictor values to get the fitted value with its 95% confidence and prediction intervals.
Data · 2 columns · 11 rows
#
1
2
3
4
5
6
7
8
9
10
11
Paste a table from Excel anywhere on the page, names in the first row.
Calculating…

About Simple Regression

How it is calculated · worked example · references

What it does

Simple linear regression fits a straight line between one input X (for example temperature, pressure, time) and one result Y (strength, thickness, yield). It tells you how much Y changes for each unit of X, whether that relationship is real or could be chance, and what Y to expect at a setting you have not tried.

A strong relationship does not prove that X causes Y. Use data from a controlled trial when you can, and check the residual plots before you rely on the line.

Method

Ordinary least squares, with exact p-values for each coefficient and for the model, R², adjusted R² and predicted R², residual checks with plots, unusual observations, and confidence and prediction intervals for a new setting. The calculation reproduces the certified values of the NIST reference data sets.

Worked example

The data behind “Try an example”: tensile strength measured at 11 temperatures from 120 to 170.

ResultValue
EquationStrength = 14.953 + 0.27236 × Temperature
p-value of the slope< 0.001
R² · R²(pred)99.18% · 98.80%
Prediction at 15857.99 · 95% PI 56.93 to 59.04

Each extra degree adds about 0.27 to the strength, the residuals pass the checks, and the line predicts new points almost as well as it fits these ones. A single new part made at 158 should measure between 56.93 and 59.04 in 95% of cases.

References

  • Montgomery, D. C., Peck, E. A. and Vining, G. G., Introduction to Linear Regression Analysis.
  • NIST Statistical Reference Datasets (StRD), linear regression.