Linear Regression Calculator
Least-squares line y = a + bx with standard errors, t and p for the slope, r², F, residual standard error and prediction at any x.
The Linear Regression Calculator fits an ordinary least-squares line to (x, y) pairs: slope b = Sxy/Sxx, intercept a = ȳ − b·x̄. It reports standard errors of both coefficients, the t-test and p-value for the slope, r², the F statistic, the residual standard error and a predicted y for a chosen x.
Free, runs in your browser. Nothing you enter is uploaded.
How to use it
- Paste X and Y.
- Read the fitted equation and statistics.
- Enter an x to predict y.
What you enter
- Paired X and Y values (n ≥ 3)
What you get
- Slope and intercept with SE
- t and p for slope
- r², F, residual SE
- Predicted y
Formula
b = Σ(x − x̄)(y − ȳ) / Σ(x − x̄)² | a = ȳ − b·x̄ | SE(b) = s_res / √Sxx
Least squares chooses the line minimising the sum of squared vertical residuals. r² is the fraction of variance in y explained by x.
Worked example
Input: X 1…10, Y 2.1 3.9 6.2 7.8 10.1 12.2 13.8 16.1 18.0 20.3
Result: ŷ = 0.0133 + 2.0230·x, r² = 0.9988, p < 0.0001
Each unit of x raises y by about 2.02; the model explains 99.9 % of the variance.
Questions
What does r² mean?
The proportion of variation in y accounted for by the linear relationship with x; 0.85 means 85 % explained.
Is the slope significant?
The p-value tests whether the slope differs from zero. Below 0.05 the linear relationship is statistically significant.
Limitations
- Simple (one predictor) regression only.
- Assumes linear relationship, independent residuals with constant variance.
References
- Altman DG, Gardner MJ (1988). Calculating confidence intervals for regression and correlation. BMJ 296:1238-1242.
Related reading
- What is Regression Analysis? A Practical Introduction
- How to Report Regression Analysis Results in a Lab Report
- Regression Analysis in Biostatistics
- Common Mistakes in Correlation and Regression Analysis
More Statistics
- Standard Deviation Calculator
- Mean, Median & Mode Calculator
- Variance Calculator
- Z-Score Calculator
- P-Value Calculator
- Confidence Interval Calculator
- T-Test Calculator
- Chi-Square Test Calculator
- Correlation Coefficient Calculator
- Normal Distribution Calculator
- Probability Calculator
- Binomial Distribution Calculator
All free tools · By Dr. Zubair Khalid, DVM, MS, PhD.