Free statistics calculators
Ad

Simple Linear Regression

Enter X and Y values to fit a regression line and calculate R².

Slope (b) —
Intercept (a) —
R² (coefficient of determination) —
Correlation (r) —
Equation —
Predicted Y —
y = a + bx. R² measures how much of the variance in Y is explained by X. R² = 1 means perfect fit; R² = 0 means no linear relationship.

Get your results + weekly data tips

One email per week. Tips, tool deals, new calculators. Unsubscribe anytime.

Free tools, useful tips. We recommend products we'd actually use.

Ad

Simple Linear Regression Explained

Simple linear regression fits a straight line (y = a + bx) to a set of data points. The slope (b) tells you how much Y changes for each unit increase in X. The intercept (a) is the Y value when X = 0.

R² (R-squared) measures how well the line fits the data. An R² of 0.85 means 85% of the variation in Y is explained by X. For prediction, plug an X value into the equation to estimate Y.

Simple linear regression fits a line y = mx + b to data, where m (slope) = [Σ(xᵢ−x̄)(yᵢ−ȳ)] / Σ(xᵢ−x̄)² and b (intercept) = ȳ − m × x̄. The line minimizes the sum of squared vertical distances from each data point to the line (least squares criterion).

R² (coefficient of determination) measures how much of the variance in y is explained by x. R² = 0 means x explains nothing; R² = 1 means x perfectly predicts y. R² = 0.75 means 75% of the variation in y is accounted for by the linear relationship with x.

Example: 5 data points — hours studied (x): 1,2,3,4,5 and exam scores (y): 50,55,65,70,75. Regression gives m ≈ 6.5, b ≈ 42.5, so y ≈ 42.5 + 6.5x. Predicted score for 3.5 hours: 42.5 + 6.5×3.5 = 65.25.

Extrapolating beyond the observed x range is risky — the linear relationship may not hold outside your data. Outliers can strongly influence both m and b; inspect your data visually before trusting regression output.

See also: Correlation Calculator · Confidence Interval Calculator