Skip to content
GraphingCalc84

Linear Regression Calculator: Simple Linear Regression & 1-Var Stats

Paste paired data, get the least-squares line with r and r², and check the residual plot before you trust a single prediction.

ŷ = 4.476x + 46.86 · r = 0.996 · r² = 0.992

Hours studied → Quiz score

LINREGa=4.47619 b=46.8571 r0.996174 r²0.992363 n8

LinReg results

ŷ = 4.4762x + 46.857
n8
x̄4.5
Σx36
Σx²204
Sx2.44949
σx2.29129
ȳ67
Sy11.0065
a (slope)4.47619
b (intercept)46.8571
r0.996174
r²0.992363

Residual plot

e = y − ŷ

No curved pattern in the residuals supports a linear model.

Linear regression calculator with steps: the default example

The workspace starts with eight students' study hours and quiz scores: , , , , , , , and . The least-squares line minimises the sum of squared vertical distances from the points to the line. Its slope and intercept come from

Here , , , and , so

The fitted model is . In context: each extra hour of study is associated with about 4.48 more quiz points on average, and a student who studies 0 hours would be predicted to score about 46.9 — an intercept that is outside the data and should be interpreted cautiously. Note that the line passes through ; that is always true for least squares.

Try it yourself · Timed check

Time 0:00 0/0 unassisted

Fit LinReg(ax+b) to the points (1, 3), (2, 5), (3, 6), (4, 9) and (5, 11). Use the line to predict ŷ at x = 7.

Simple linear regression model: formula, slope and y-intercept

A simple linear regression model has one independent variable x (the predictor) and one dependent variable y (the response): ŷ = a + bx. The calculator on this page finds a and b by ordinary least squares, minimizing the sum of the squared residuals Σ(y − ŷ)². That gives the linear regression formula:

  • slope: b = r · sy / sx
  • y-intercept: a = ȳ − b · x̄

Here r is the correlation and sx, sy are the standard deviations of the x and y values. Watch the naming: the 84-series LinReg(ax+b) writes the line as y = ax + b, so its a is the slope, while LinReg(a+bx) uses the textbook order. The results of the regression are the same line either way.

To calculate the linear regression by hand for (1, 2), (2, 4), (3, 5), (4, 4), (5, 6): x̄ = 3 and ȳ = 4.2, Σ(x − x̄)(y − ȳ) = 8 and Σ(x − x̄)² = 10, so b = 0.8 and a = 4.2 − 0.8 · 3 = 1.8. The least squares regression line is ŷ = 1.8 + 0.8x. A linear regression prediction at x = 6 is 1.8 + 4.8 = 6.6, an estimate of the value of y that is also an extrapolation, because 6 lies outside the data.

For inference on the slope, the standard error uses n − 2 degrees of freedom (here 3), because two parameters were estimated. The model assumes the observations are independent of one another, with residuals that are roughly normal and have constant spread.

Linear regression analysis vs multiple regression

This is a simple linear regression calculator: one predictor. Multiple regression models y with several predictors (ŷ = b₀ + b₁x₁ + b₂x₂ + …) and needs statistical software or a spreadsheet; any multiple regression calculator also has to watch for predictors that are highly correlated with each other, which makes individual slopes unstable. Logistic regression is different again: it is used when the response is a yes/no outcome rather than a number. For a response variable based on one numeric x, find the linear regression here and then check the residual plot.

Residual plot: the check most people skip

A high does not mean a line is the right model. Plot residuals against :

x12345678
y5255616470727983
ŷ51.33355.81060.28664.76269.23873.71478.19082.667
e0.667−0.8100.714−0.7620.762−1.7140.8100.333

The residuals bounce above and below zero with no curve and no widening spread, so a linear model is appropriate. Three patterns should make you stop:

  • A curve (U or arch): the relationship is not linear; try QuadReg or a transformation.
  • Fanning: residuals spread out as grows, so predictions are less reliable for large . This is common with incomes and populations.
  • One huge residual: an outlier; check it for a data-entry error before removing anything.

Self-check: r ≈ 0.9789 looks strong, yet the residuals form a U — switch the model to quadratic.

The standard deviation of the residuals, , says a typical prediction misses by about one point.

1-Var statistics for the same data

Before fitting any model, summarise each variable. For the eight quiz scores, 1-Var Stats returns:

OutputValueMeaning
67Mean
Σx, Σx²536, 36 760Sum and sum of squares
Sx11.0065Sample standard deviation (divides by )
σx10.2956Population standard deviation (divides by )
n8Count
minX, Q1, Med, Q3, maxX52, 58, 67, 75.5, 83Five-number summary (median of each half)

Use Sx for a sample (almost every class problem); use σx only when the list is the entire population. Mixing them up is one of the most common lost points in statistics homework.

Self-check: x̄ = 67, Sx ≈ 11.0065, σx ≈ 10.2956 and Med = 67.

Keystroke reference: STAT → CALC workflow

TaskTI-84 style key sequenceGraphingCalc84
Enter dataSTAT → 1: Edit → L1, L2Paste x, y pairs, one per line
Summary statsSTAT → CALC → 1: 1-Var StatsSummary panel
Linear fitSTAT → CALC → 4: LinReg(ax+b)Model: LinReg (ax+b)
Quadratic fitSTAT → CALC → 5: QuadRegModel: QuadReg
Exponential fitSTAT → CALC → 0: ExpRegModel: ExpReg
Show r and r²STAT DIAGNOSTICS: ONAlways shown
Residual plot2ND Y= → Plot2, Ylist: RESIDResidual plot toggle

A frequent handheld error is ERR: DIM MISMATCH, which means L1 and L2 have different lengths — usually one value was skipped or typed twice. Pasted data here is parsed in pairs, so a line missing its y-value is flagged instead.

Correlation is not causation, and r is not everything

A strong correlation between study time and scores is plausible, but the data cannot rule out a lurking variable such as prior grade or interest in the subject. Only a randomized experiment supports a causal claim. Also remember that measures linear association only: data lying perfectly on the parabola for has . The NIST/SEMATECH e-Handbook of Statistical Methods has an excellent chapter on regression diagnostics, including residual analysis.

Next steps

If you are preparing for the AP exam, the AP Statistics calculator toolkit covers LinRegTTest, confidence intervals and how to report calculator output on free-response questions. To find probabilities rather than fit lines, use the normal distribution calculator.

Exponential regression in one paragraph

ExpReg fits by running a linear regression on and transforming back, so every y-value must be positive. The base is the growth factor per unit of : means an 8% increase per step, and a 10% decrease. Judge the fit with a residual plot on the original scale, exactly as for a line.

Frequently asked questions

How do I calculate linear regression on a TI-84?
Enter x-values in L1 and y-values in L2 (STAT → 1: Edit), then press STAT → CALC → 4: LinReg(ax+b) and run it on L1, L2. For the default data here the result is a ≈ 4.4762 (slope), b ≈ 46.857 (intercept), r ≈ 0.99617. Turn on diagnostics (MODE → STAT DIAGNOSTICS: ON, or DiagnosticOn from the catalog on older systems) to see r and r².
What is the difference between r and r²?
r is the correlation coefficient, between −1 and 1, and measures the strength and direction of a linear relationship. r² is the coefficient of determination: the share of the variation in y explained by the line. With r = 0.99617, r² = 0.99236, so about 99.2% of the variation in quiz scores is explained by hours studied.
What is a residual?
A residual is observed minus predicted: e = y − ŷ. For x = 6 hours the line predicts 4.4762(6) + 46.857 = 73.714, and the observed score is 72, so the residual is −1.714. Residuals of a least-squares line always sum to 0.
Can I use a regression line to predict outside my data?
Only with great caution. Predicting beyond the observed x-range is extrapolation; the line may not hold there. The default data run from 1 to 8 hours, so predicting a score for 20 hours (136 points) is clearly meaningless.
Does a high correlation prove that x causes y?
No. Correlation measures linear association only. A lurking variable, such as prior knowledge, can drive both study time and scores. Causation needs a randomized experiment, not just a strong r.
When should I use exponential or quadratic regression instead?
When the residual plot from a linear fit shows a curve. A U-shape suggests quadratic (QuadReg); growth that multiplies by a constant factor suggests exponential (ExpReg, y = a·bˣ). Compare residual plots, not just r², to choose a model.