The ordinary least squares solution#
The question and the claim#
Ordinary least squares minimizes a sum of squared residuals. Its equivalence to maximum likelihood requires a specified error model, such as independent Gaussian errors of common variance. Existence of a numerical solution and validity of an inference are separate questions.
What you should be able to do#
Specify the scientific target and the observations needed to address it.
Check dimensions, agreement of predictions, and rank. Explain which assumptions are needed for estimation and which are needed for the chosen interval.
Explain the assumptions, uncertainty, and limits of your conclusion.
Worked investigation#
Compare covariance-based coefficients, lm(), QR-based least squares, and numerical optimization for the same simulated data. The worked notebook is self-contained and uses documented teaching data. Its output is evidence about that example, not a finding about a human population.
Challenge the result#
Explicitly inverting a nearly singular cross-product matrix can be numerically unstable. Full column rank governs uniqueness; it is not the same as independent predictors. Before running an analysis, predict what this failure would change. After running it, distinguish a software check from a scientific justification.
Practice and verification#
Complete the exercise, then discuss the interpretation questions. Submit a runnable notebook, your assumptions, and a short evidence-based interpretation. The shared analysis workflow defines the reporting and assessment standard.
For AI assistance, first write your own target and expected behavior. Use generated suggestions as candidates, inspect the code or claims, and retain evidence of the checks you performed. The AI analysis guide includes a saved-output activity that requires no account or paid service.
Connection across lessons#
Translate the preceding linear model into an objective; use diagnostics to challenge that model next.
Earlier lecture resources#
The recordings and slides below are retained from the earlier course edition and have not been revised. Use the written chapter, revised notebook, and exercise for current definitions and procedures; earlier examples may conflict with the corrections described here.
