Linear Regression Calculator

Paste paired data, fit a least-squares line, inspect r and R², and estimate y for a chosen x without building the formulas yourself.

Examples

School: study time vs score

Fit a line from study hours and quiz scores, then estimate the score for 6 hours.

Entry style
Two lists
X observations
1, 2, 3, 4, 5
Y observations
62, 68, 74, 81, 86
Paired rows
1, 62 2, 68 3, 74 4, 81 5, 86
Predict y when x =
6
Regression line
y = 55.9 + 6.1x
Slope b
6.1
Intercept a
55.9
Correlation r
0.999061
0.998122
Predicted y
92.5

Examples

School: study time vs scoreFit a line from study hours and quiz scores, then estimate the score for 6 hours.y = 55.9 + 6.1x
Business: ad spend vs leadsUse paired weekly spend and lead counts to estimate the lead level at the next spend value.y = -0.4 + 2.2x
Science: concentration vs responseSummarize a lab-style linear pattern and inspect whether the fit is tight or weak.y = 0.5 + 1.28x

How It Works

Formula

b=(xixˉ)(yiyˉ)(xixˉ)2b = \frac{\sum (x_i - \bar{x})(y_i - \bar{y})}{\sum (x_i - \bar{x})^2}

a=yˉbxˉa = \bar{y} - b\bar{x}

r=(xixˉ)(yiyˉ)(xixˉ)2(yiyˉ)2r = \frac{\sum (x_i - \bar{x})(y_i - \bar{y})}{\sqrt{\sum (x_i - \bar{x})^2 \sum (y_i - \bar{y})^2}}

R2=r2R^2 = r^2

Variables

xix_i

Observed x value in pair i

yiy_i

Observed y value in pair i

xˉ\bar{x}

Mean of the x values

yˉ\bar{y}

Mean of the y values

bb

Least-squares slope of the fitted line

aa

Least-squares intercept of the fitted line

rr

Correlation coefficient for the linear association

R2R^2

Share of y variation explained by the line

Linear regression fits one straight line to your paired data. The slope shows how much y tends to change when x increases by 1, and the intercept is the line value when x = 0.

Use this tool when you already have paired observations, such as study time vs quiz score or concentration vs response. A larger absolute r means a tighter linear pattern in the entered points, while tells you how much of the variation in y the line accounts for. A useful line can still have a weak fit, and a strong fit still does not prove causation.

Frequently Asked Questions

01What does the slope mean here?
The slope **b** is the line change in **y** for each 1-unit increase in **x**. A positive slope means the fitted line rises; a negative slope means it falls.
02What does R² tell me?
R² is the share of variation in **y** explained by the fitted line. Values near 1 mean the line tracks the entered points closely; values near 0 mean it explains little of the variation.
03Does a high correlation prove causation?
No. Regression describes an association in the data you entered. It cannot show whether one variable causes the other.
04Should I trust predictions far outside my data?
Be careful. The predicted y is only the line value for the x you typed. Estimates get less defensible when you predict well beyond the observed x range.

All calculators