Learn

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 13 of 26

Fit parameters and inspect what the fit misses

Derive least squares and use residual patterns.

Loading your saved responses…

Try the optional starting-point checks and targeted refreshers. You can continue directly into this lesson.

Try

A synthetic experiment records output y at input x. You propose y=bx with no intercept and observe (1,3) and (2,4). Neither point alone should determine the slope when both are noisy. Least squares chooses the slope minimizing the sum of squared discrepancies, but its result depends on the model form and loss.

Write the objective before calculating: S(b)=(3−b)²+(4−2b)². The decision to omit an intercept is a substantive assumption, not merely a shortcut in the algebra.

Predict

The individual slopes are 3 and 2. Predict whether the least-squares slope is their simple average. The larger input has greater leverage in a through-origin fit, because changing b changes its prediction more strongly.

Experiment

Differentiating gives S′=−2(3−b)−4(4−2b)=10b−22, so b=11/5. The second derivative is 10, proving the unique minimum.

xObserved yFitted bxResidual y−bx
1311/54/5
2422/5−2/5

The squared-error sum is 4/5. The residuals do not sum to zero, but the input-weighted residual sum does: 1·(4/5)+2·(−2/5)=0. A zero residual sum is a property of an intercept-containing ordinary least-squares fit, not every fit.

Understand

For y≈Xθ, differentiating ∥y−Xθ∥² yields the normal equations XᵀXθ=Xᵀy. Full column rank makes the minimizer unique. If columns are dependent, different parameters can yield the same fitted vector. Numerically, directly forming normal equations can worsen conditioning; QR or singular-value methods are often preferable. The derivation identifies the optimum condition, not a mandate for one implementation.

Ordinary least squares coincides with maximum likelihood for independent normal errors with common variance and the stated mean model. Normality is not needed to define or compute the minimizer. Unequal variances suggest weights; correlated errors require a covariance-aware loss if the probabilistic assumptions justify it. Robust losses change the influence of large residuals and answer a different optimization question.

Residuals should be inspected against input, time, fitted value and relevant groups. Curvature may indicate a missing nonlinear term, but it can also reflect sensor calibration or an omitted variable. A residual pattern suggests hypotheses; it does not identify a unique cause. Test a revised model on observations not used to select that revision.

Parameter bounds can also matter. If a physical rate must be nonnegative, an unconstrained negative estimate signals either noise, misspecification or an inappropriate unconstrained fit. Report the constraint and whether the optimum lies on its boundary rather than silently replacing the estimate after fitting.

Apply

Fit one simple model to a small explicit dataset and show the objective, derivative or solver condition, estimate and residual table. Compare a baseline and identify one plausible misspecification. State which observations were used for fitting and which remain available for validation. Optimizer convergence is evidence about the numerical objective, not about the model’s truth.

Continue

Sensitivity analysis next asks how predictions change when inputs or parameters move. A precise fitted value can still support a fragile decision if the output is highly sensitive in a poorly measured direction.

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.

Fit y=bx through the origin to observations (1,2),(2,5) by least squares. Find b.

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

For that fit, what is the sum of squared residuals?

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

Derive the normal equations for minimizing ∥y−Xθ∥².

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.

When does ordinary least squares coincide with maximum likelihood?

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.

What does a curved residual pattern against the input suggest, and what does it not prove?

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.

Fit one bounded model and report the residuals as evidence.

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.