Skip to content

Linear Regression Calculator

Linear regression online with coefficients, p-values, R squared, residual plots and 95 percent CIs.

Open the Simple Linear Regression calculator

When to use it

Use to predict a continuous outcome Y from a single continuous predictor X. Returns the slope, intercept, R-squared, and significance tests, plus diagnostic plots that tell you whether the linear assumption is reasonable.

When NOT to use it

Do not use for binary outcomes (use logistic regression). Do not use for count outcomes (use Poisson or negative binomial). Do not use when residuals show a clear curve in the residual-versus-fitted plot; consider polynomial terms or a transformation. For multiple predictors use the Multiple Regression tool.

What you get

Slope and intercept with their standard errors, t-statistics, p-values, and 95 percent confidence intervals; R-squared and adjusted R-squared; the F test of the model; the regression equation written out; a residual-versus-fitted plot, a normal Q-Q plot of residuals, and the fitted line on a scatter of the raw data.

Worked example

Fifteen-pair height (m) and mass (kg) dataset, American women aged 30 to 39 (R built-in `women`).

1.47, 1.50, 1.52, 1.55, 1.57, 1.60, 1.63, 1.65, 1.68, 1.70, 1.73, 1.75, 1.78, 1.80, 1.83
52.21, 53.12, 54.48, 55.84, 57.20, 58.57, 59.93, 61.29, 63.11, 64.47, 66.28, 68.10, 69.92, 72.19, 74.46

Expected output: intercept = -39.062, slope = 61.272, r = 0.9946

Source: Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988). The New S Language. Wadsworth and Brooks (source of R `women`). Reproduced as the introductory simple-LM example in Draper, N. R. and Smith, H. (1998), Applied Regression Analysis, 3rd ed., Wiley, ch. 1.

How to interpret the output

The slope is the expected change in Y per one-unit increase in X. The intercept is the expected Y when X equals zero (often not biologically meaningful, do not over-interpret). R-squared is the proportion of variance in Y explained by X; its square root is the absolute Pearson correlation. A significant F (or equivalently a significant slope t) means X has a non-zero linear effect on Y at the chosen alpha. Cross-checked against R lm() on the 15-pair height-mass `women` dataset (Becker, Chambers and Wilks 1988; Draper and Smith 1998 ch. 1).

Common pitfalls

Try it in StatVeda

The Simple Linear Regression engine runs entirely in the browser. No signup, no install, no data sent to a server. Paste your data, hit Run, copy the output.

Open Simple Linear Regression

References

Related concepts

Related calculators