Lawfare Academy · Complete Regression and Business Forecasting edition 6
Multiple regression: identify the partial comparison and its uncertainty
Make the design matrix concrete
With n observations and p coefficients, each row of X contains an intercept and the chosen predictors. Least squares minimizes (y-Xb)'(y-Xb). Differentiation gives X'X b=X'y. Full column rank means no column can be exactly reconstructed from the others, so a unique coefficient vector exists. Software should solve with a stable decomposition rather than explicitly invert X'X. Rank deficiency is missing identification in the observed design, not a rounding error cured by renaming columns.
For a transparent new fixture, use centered predictors u=(-1,-1,1,1,0,0), v=(-1,1,-1,1,-1,1) and outcomes y=(7,9,9,15,7,13). The predictor means are zero; sum(u²)=4, sum(v²)=6 and sum(uv)=0. Their cross-products with y are sum(uy)=8 and sum(vy)=14; mean(y)=10. The orthogonal design gives intercept 10, u coefficient 2 and v coefficient 7/3. Fitted values are (17/3,31/3,29/3,43/3,23/3,37/3), and residuals (4/3,-4/3,-2/3,2/3,-2/3,2/3). The residual sum and each predictor-residual cross-product are zero. SSE=16/3 and n-p=3, so s²=16/9. Do not confuse this noisy fixture with the preserved Academy exact-fit season or branch constructions.
Partial out the other predictors
A partial coefficient compares the component of a predictor that is not linearly explained by the other included columns. Regress u on the intercept and v, and keep residual ru. Regress y on those same columns, and keep residual ry. The slope sum(ru*ry)/sum(ru²) is the u coefficient in the full model. This residualization identity explains 'holding included predictors fixed' without claiming that an actual intervention can independently vary them. Here u is orthogonal to both columns, so ru=u and the coefficient is 8/4=2.
If u were exactly twice v, its residual after adjustment would be zero and that denominator would vanish. Near collinearity instead leaves a small denominator and large coefficient uncertainty. VIF_j=1/(1-R_j²), where R_j² comes from regressing predictor j on the other predictors with an intercept. A VIF of 5 multiplies that coefficient's variance by 5 relative to an otherwise matched orthogonal design, or its standard error by sqrt(5). It is not a universal deletion threshold or evidence of confounding. Deleting a substantively essential variable can change the estimand while making a table appear tidier.
Inference is for a specified model
Under independent common-variance zero-mean errors, the coefficient covariance estimate is s²(X'X)^-1. For this orthogonal design, diagonal entries are s²/6 for the intercept, s²/4=4/9 for u, and s²/6=8/27 for v, with cross-covariances zero. Thus SE(u)=2/3 and SE(v)=sqrt(8/27). Normal errors give t statistics with three residual df for individual linear hypotheses. The u=0 statistic is 3. The v=0 statistic is (7/3)/sqrt(8/27), approximately 4.28661. A more complete fitted mean and a significant-looking coefficient are not automatic evidence of a causal mechanism.
For any contrast c'b, variance is c'Cov(b)c. At u=1,v=1 the fitted mean is 43/3. Its variance is s²(1/6+1/4+1/6)=28/27. A new individual's prediction variance adds s², yielding 76/27. Using separate coefficient intervals and adding their endpoints does not generally produce an interval with the intended coverage for a contrast. Compute the covariance-weighted contrast directly and state pointwise or simultaneous scope.
Compare nested models with the right denominator
The intercept-only SSE is sum((y-10)^2)=54. Adding both predictors reduces SSE to 16/3. The overall F is [(54-16/3)/2]/[(16/3)/3]=219/16=13.6875 on 2 and 3 df. To test u after v, the reduced intercept-plus-v SSE is 64/3. The one-parameter partial F is [(64/3-16/3)/1]/[(16/3)/3]=9, equal to the u t-squared. This test answers whether u adds explanatory mean structure under the specified model after v; it does not rank u's causal importance or establish future forecasting value.
Adjusted R-squared=1-[SSE/(n-p)]/[SST/(n-1)]. Here R-squared=1-(16/3)/54=73/81, whereas adjusted R-squared=1-(16/9)/(54/5)=203/243. Ordinary R-squared cannot fall when unrestricted predictors are added to the same rows; adjusted R-squared can. Neither substitutes for a locked later evaluation. Comparing models on different missing-data subsets confounds a specification change with a sample change. Retain the exact eligible rows and compare on a common design or explain why the targets differ.
Confounding, mediation and selection require a question
The preserved seasonal example has a pooled slope 10 and adjusted slope 2 because spending composition and a 20-unit season shift are mixed. That decomposition is strong teaching and stays intact. More generally omitted-variable bias in the simple population projection is beta_z*Cov(x,z)/Var(x), given the stipulated correctly specified full mean. Its sign needs both terms. Adding a pre-intervention confounder may help under adequate measurement and overlap. Adding a post-intervention mediator changes the target from a total relation; conditioning on a selection collider can introduce an association. Use temporal and causal reasoning before selecting columns by p-value. Reverse causation remains possible when management spends in response to anticipated sales.
Optional practice and changed facts
Guided model: residualization and rank
The fixture's centered cross-product sum(u*v)=0, so residualizing u on the intercept and v leaves u. Its coefficient is 8/4=2. Changed fact: replace u with 2 v. The design loses rank; separate u and v effects are not identified. Report that restriction and recover appropriate variation rather than interpreting whichever coefficient the software retains.
Independent model: nested fit versus prediction
Full SSE=16/3, reduced-v SSE=64/3 and residual variance 16/9 give partialF=9=t_u². The overall two-predictorF=13.6875 uses a different comparison. Changed fact: the larger model was selected from 100 candidate combinations after inspecting these same outcomes. The nominal preplanned F comparison no longer describes the whole selection procedure. Disclose the search, keep model building inside training and use a genuinely later or properly nested evaluation before claiming predictive improvement.
Transfer model: an unsupported operating point
The fitted mean at u=v=1 is 43/3 and estimated mean variance 28/27; individual variance 76/27. Changed fact: the proposed action sets u=10 outside observed -1 through 1. The formulas can produce a number, but neither covariance nor a wider interval validates the extrapolated mean or an intervention effect. Collect relevant operating-range evidence or narrow the recommendation.
Unit rubric: 20 points
Award four points each for constructing full-rank X and normal equations; residualized conditional interpretation; coefficient/contrast covariance and df; matched nested comparisons with sample preservation; and causal/validation limits with changed facts. Complete model: retain intercept 10,u 2,v 7/3,SSE 16/3,df 3,s²16/9,partialF 9,overallF 5.25,R²7/9,adjustedR²17/27. Report exact synthetic-design limits and a future-data validation plan, not a causal spending authorization.
Optional source summary: NIST linear least squares describes linearity in coefficients and fit limitations. The orthogonal design, residualization explanation and complete numerical models above are original.