Learning preferences

Make learning more comfortable. Changes apply immediately.

Enlarges page content, including diagrams and their labels. You can also use your browser’s zoom.

Choose the colours that are easiest for you to distinguish. Applies to lesson diagrams and lab plots. Labels, shapes, hatching and line patterns also distinguish meanings. Source photographs and raw image brightness stay unchanged; mask-only views are available for image overlays.

ExampleComparisonSample link

Saved in this browser on this device. Preferences are separate from progress backups.

Lesson 9 of 18

Fit a line and inspect its failures

Connect a least-squares model to residuals, influence and prediction limits.

Loading your saved responses…

Try

For pairs (0,1), (1,2), (2,5), try a line with slope two. No single intercept makes it pass through all three points. Predict how a fitting rule could compromise between overprediction and underprediction. Simply minimizing signed errors is unsuitable because positive and negative errors cancel.

Predict

Predict whether the fitted line must pass through every observation or through the point of sample means. Also predict what a curved pattern in residuals would mean. A small average signed error does not establish that the model has captured the relationship.

Experiment

For these synthetic data, x̄=1 and ȳ=8/3. The squared-x-deviation sum Sxx is 1+0+1=2. The cross-deviation sum Sxy is 5/3+0+7/3=4. Least-squares slope b=Sxy/Sxx=2, and intercept a=ȳ−bx̄=2/3.

xObserved yPredicted yResidual
012/31/3
128/3−2/3
2514/31/3

Check that residuals sum to zero and their squared sum is 2/3. In the live regression investigation, change the final observation and inspect how every fitted value can move.

Understand

Least squares chooses coefficients minimizing the sum of squared residuals for the stated data and model. The fitted value is ŷ=a+bx, where x is the predictor, b is slope and a is intercept. A residual is observed minus predicted: e=y−ŷ. It has the response variable’s units. A negative residual means the model predicted too high.

The slope formula requires variation in x: Sxx must be positive. With all x values identical, the usual slope is not identified. For an unconstrained least-squares line with an intercept, the line passes through (x̄,ȳ), and residuals sum to zero. These algebraic properties do not guarantee that a straight line is an appropriate scientific model.

Plot residuals against x or fitted values. A curved pattern suggests the mean relationship may not be linear. A widening spread suggests variability changes with x. Clusters or time patterns can indicate omitted structure or dependence. These are reasons to investigate, not automatic instructions to transform or delete observations. Inference about a slope requires additional assumptions and methods beyond fitting a line.

In simple linear regression with an intercept and nonzero response variation, r² equals the fraction of the observed total squared response variation accounted for by the fitted line. It does not measure the fraction of outcomes caused by x, nor guarantee accurate prediction for new cases. High fit can coexist with biased sampling or an inappropriate causal story.

Interpolation predicts inside the observed x range; extrapolation goes outside it. A battery model fitted from 10–30°C may be unreliable at 80°C because the underlying mechanism can change. Even interpolation needs care when relevant subgroups or operating conditions differ from the training data.

Apply

Fit the small example by hand and check the residual direction against the graph. In the live investigation, compare including and excluding the unusual point, then write what independent evidence would justify exclusion. Report how the slope changes without calling the preferred slope the true effect.

Continue

Next examine transformations. A new scale can clarify structure, but it changes how coefficients and averages must be interpreted.

Apply · explain · revise

Practice and reasoning

Drafts save locally as you type. Reveal worked solutions when useful; the site remembers that exposure. Automatic matches check the requested answer, while written arguments require review against the rubric.

For three pairs, Σ(x−x̄)²=8 and Σ(x−x̄)(y−ȳ)=12. Find the least-squares slope.

Integers, fractions and finite decimals are accepted. Expressions such as sqrt(2) are not parsed by this checker.

A least-squares line has slope3/2, x̄=4 and ȳ=9. Find its intercept.

Integers, fractions and finite decimals are accepted. Expressions such as sqrt(2) are not parsed by this checker.

The fitted line is ŷ=3+1.5x. At x=6 the observed y is10. Find the residual.

Integers, fractions and finite decimals are accepted. Expressions such as sqrt(2) are not parsed by this checker.

A residual plot shows a systematic U shape. What is a reasonable response?

Your response

Fit a least-squares line to (0,1),(1,2),(2,5), and report the three residuals.

Structure your argument and preserve revisions

These optional planning fields save locally. Recording your response saves an immutable copy of the argument and these fields. Older records may contain only first/latest responses; missing intermediate revisions are not reconstructed.

Each field allows 2,000 characters. Keep a specific claim, state where it applies, cite the facts you use, and explain what still needs checking. Blank fields are allowed and are not evidence of mastery.

A line is fitted to battery performance at temperatures10–30°C. Evaluate a prediction at80°C and a causal claim from its slope.

Structure your argument and preserve revisions

These optional planning fields save locally. Recording your response saves an immutable copy of the argument and these fields. Older records may contain only first/latest responses; missing intermediate revisions are not reconstructed.

Each field allows 2,000 characters. Keep a specific claim, state where it applies, cite the facts you use, and explain what still needs checking. Blank fields are allowed and are not evidence of mastery.

Reflect and continue

Before marking this lesson complete, explain one key idea without the worked solution and identify a condition that matters. Marking complete records participation, not independent mastery.