AP Stats Linear Regression Calculator
Enter paired x and y values to get the least-squares regression line, slope, intercept, and correlation r. This AP Stats Linear Regression Calculator is made for bivariate data, scatter plots, and LinReg questions on the AP Statistics exam.
Linear Regression Calculator
Interactive visual: Live preview
Press Show live preview to redraw this chart from your calculator inputs.
What Is Linear Regression?
Linear regression fits a straight line, y-hat = a + bx, that best describes how a response variable y changes with an explanatory variable x. The slope b tells you how much y is predicted to change when x increases by one unit, and the intercept a is the predicted value of y when x is 0. The line is chosen by least squares, which makes the sum of the squared residuals as small as possible.
Interactive visual: See the idea
Example: x = 1, 2, 3, 4, 5 and y = 2, 4, 5, 4, 7 — slope 1.1, intercept 1.1, r about 0.90.
How to Use This Calculator
Interactive visual: Walk through it
Step 1: Open the AP Stats Linear Regression Calculator calculator at the top and enter the values it asks for.
1. Type your explanatory variable values in the X box and your response values in the Y box, in the same order, separated by commas. 2. Press Calculate Regression Line. 3. Read the equation, slope, intercept, and r, then check the scatter plot with the fitted line. The point (x̄, ŷ) always lies on the line, which is a useful check.
How to Calculate Linear Regression
Interactive visual: See it on a chart
Press Update visual to redraw this chart from your calculator inputs.
Formulas: slope b = Σ(x − x̄)(y − ŷ) / Σ(x − x̄)2, intercept a = ŷ − b·x̄, and the line is ŷ = a + b·x. Correlation r = Σ(x − x̄)(y − ŷ) / √[Σ(x − x̄)2 Σ(y − ŷ)2].
Worked example: For x = 1, 2, 3, 4, 5 and y = 2, 4, 5, 4, 7, x̄ = 3 and ŷ = 4.4. The slope is b = 11 / 10 = 1.1, the intercept is a = 4.4 − 1.1(3) = 1.1, so ŷ = 1.1 + 1.1x, and r ≈ 0.90. Try these exact values in the calculator to see the same result.
Tips and Common Mistakes
Interactive visual: Mistake vs correct
Mistake: Extrapolating far beyond the observed x values.
Do not mix up x and y: swapping them gives a different line. Always interpret slope in context, for example "for each additional unit of x, y increases by about b units on average." Do not extrapolate far beyond your x-values, and do not say correlation proves causation. Check residuals: a curved residual plot means a straight line is not the best model, even if r looks strong.
Frequently Asked Questions
Interactive visual: FAQ
Tap any question below to show or hide its answer.
What does the slope mean in AP Statistics?
The slope is the predicted change in y for a one-unit increase in x, on average, for the data in the study.
What does the intercept mean?
The intercept is the predicted y-value when x = 0. It only makes sense in context if x = 0 is inside or near the data range.
What is the difference between r and r-squared?
r measures the strength and direction of a linear relationship, from −1 to 1. r-squared is the proportion of variation in y explained by the linear model in x.
Can I use this calculator for LinRegTTest?
This calculator gives the line, slope, intercept, and r. A LinRegTTest also tests whether the population slope is zero; use its p-value for that inference question.
Why is my r close to 1 but the model still wrong?
Outliers and influential points can inflate r, and a strong r does not rule out a curved pattern. Always look at the scatter plot and residual plot.
Does the TI-84 give the same line?
Yes. On a TI-84, use STAT, CALC, LinReg(a+bx) with the same lists. The slope, intercept, and r should match this calculator.
AP is a trademark of the College Board, which was not involved in this site.
Related Calculators and Guides
Keep exploring AP Statistics with calculators and guides related to this tool.
Related Calculators
Interactive visual: Tool path
Start with this tool, then follow the path through the related calculators.
Linear Regression Calculator → Correlation Coefficient Calculator → R-Squared Calculator