Learn with Amar
Teaching video
A teaching recording for this chapter has not been published yet. Start with the worked example below and explore the related animations where available.
Browse grades and teaching videos01 · Read and understand
What you will learn
- Calculate the least-squares slope and intercept.
- Predict within the observed input range.
- Compute and interpret a signed residual.
Before you start
Means, signed differences, squared values, and linear equations.
Keep paper nearby. Read the question once for the context, then again to identify what is known and what you need to find.
Start with a question
For a fictional process, observed pairs are (1, 2), (2, 3), and (3, 7), where x is setup time in hours and y is output in units. Find the least-squares line and predict y at x = 2.5.
Why this math matters
A fitted line summarizes a linear association while allowing observations to miss the line. Least squares chooses coefficients that minimize the total squared vertical discrepancies. The fitted equation can support interpolation, but a good numerical fit alone does not establish causation or justify predicting far outside the observed input range.
Set up the model
A useful answer starts with clear assumptions:
- These are three exact recorded pairs in a fictional descriptive example.
- A line is chosen as a summary model, not assumed to explain every mechanism.
- No statistical confidence interval or causal claim is made from this tiny data set.
02 · Work through the example
Follow the reasoning, one step at a time.
Try to predict the next step before reading it. After each calculation, explain why the operation makes sense and how it helps answer the original question.

Work through it with Amar
See this example unfold.
The complete worked example, one idea at a time.
How does a regression line choose its slope?
PausedQuestion: Start with the question. Paused.
Question
Start with the question
For a fictional process, observed pairs are (1, 2), (2, 3), and (3, 7), where x is setup time in hours and y is output in units. Find the least-squares line and predict y at x = 2.5.
Before you calculate
Read what is known and what you need to find. Make a prediction before moving to the first calculation.
Starts paused. Play advances through the full text at a reading pace; pause whenever you need more time. Previous, Next, and the phase buttons let you set your own pace. Playback pauses when this walkthrough leaves the screen or you switch tabs.
Your device’s reduced-motion setting keeps each phase still. Manual controls remain available. The full written solution stays below.
Center the two variables
x̄ = 2; ȳ = 4; Sxx = 1 + 0 + 1 = 2; Sxy = 2 + 0 + 3 = 5
Multiply each x deviation by its paired y deviation for Sxy. Preserving the original pairs is essential.
Find slope and intercept
b₁ = Sxy/Sxx = 2.5; b₀ = ȳ − b₁x̄ = −1; ŷ = −1 + 2.5x
The fitted line passes through the pair of sample means. Its slope describes the modeled output change per additional setup hour.
Predict and inspect a residual
ŷ(2.5) = 5.25; at x = 2, residual = 3 − 4 = −1
The prediction lies within the observed x range. A negative residual means the actual observation falls below the fitted line.
The result
The least-squares line is ŷ = −1 + 2.5x, predicting 5.25 output units at 2.5 setup hours.
The negative intercept is a mathematical consequence of this fit; zero setup hours lies outside the observed range. The three residuals are 0.5, −1, and 0.5, whose squared sum is 1.5. Other mechanisms could explain the association.
Common mistakes to catch
- A slope from observed association is not automatically the causal benefit of adding one hour.
- A fitted negative intercept need not be physically meaningful outside the observed range.
03 · Practice independently
Try it before revealing the answer.
Use paper or a calculator as needed. Write your units and reasoning, then open the hint or explanation to check your approach.
Practice 1
What residual corresponds to the observation (3, 7)?
Show a hint
Subtract the fitted value from seven.
Reveal answer and explanation
+0.5 unit
The line predicts −1 + 2.5(3) = 6.5, so the residual is 7 − 6.5 = 0.5.
Practice 2
What does the line predict at x = 4, and what caution applies?
Show a hint
Four lies beyond the observed range one through three.
Reveal answer and explanation
9 units; this is extrapolation
The arithmetic gives −1 + 10 = 9, but the available data do not establish that the linear pattern continues there.
Take the idea with you
Plot residuals as well as the fitted line; systematic patterns may reveal a missing nonlinear relationship.
04 · Reflect and continue
Can you explain it in your own words?
Before moving on, explain the main idea without looking at the worked example. Try both practice questions, check your reasoning, and name one mistake you now know how to avoid. Return to a step if you still need support.
Up next: How does changing the time window change a count probability?
Completion is your own study record, not a test score. It stays in this browser, does not sync to another device, and can be removed by clearing browser data.