Lawfare Group → Knowledge Institute → Lawfare Academy

← Course syllabus · Related lesson

Derive a partial slope and inspect the comparison it uses

Current complete on-site native edition3

All required original teaching, complete derivations and optional practice models are on LawfareGroup.com. External references are optional provenance or further reading. Florida is the state-law default; federal, historical and comparative contexts remain distinct. Independent human subject review and observed learner testing remain pending. Synthetic economic models establish no actual market response, legal clearance or professional competence.

Preserved and additional cumulative dossiers

Original extended teaching; see the linked current course-content review for its development status. Practice is optional; independent academic review and learner testing remain pending.

Learning objectives

A small dataset that can be checked completely

Use eight synthetic observations with columns(x,D,y): (0,0,8.5), (1,0,11.5), (2,0,14.5), (3,0,17.5), (4,1,24.5), (5,1,25.5), (6,1,26.5), (7,1,27.5). Interpret x as a measured business input and D as a binary group. These are deliberately constructed training data, not actual customer or learner records. The target fitted model is y=b0+b1x+b2D+e.

Ordinary least squares minimizes the sum of squared residuals. With design columns 1,x,Dand full column rank, its normal equations are X'X b=X'y. Here X'X has rows (8,28,4),(28,140,22),(4,22,4), and X'y=(156,670,104). Solving gives b=(10,2,5). Fitted values are 10+2x+5D; residuals are (−1.5,−.5,.5,1.5,1.5,.5,−.5,−1.5). Their sum and their products with each design column sum to zero, as the normal equations require.

The residual sum of squares is 10. Total centered sum of squares is 388, so R²=1−10/388=189/194≈.97423. This high in-sample fit does not establish the common slope is correctly specified or causally identified. Later units show that the two groups follow different slopes in this constructed example. A model can have high R² while omitting a consequential interaction.

Partialling out reveals the identifying linear variation

To understand the x coefficient, first regress x on the intercept and D. That subtracts group means 1.5 and5.5. Residual x values within each group are (−1.5,−.5,.5,1.5). Regress y on the same controls: group means are 13 and26. The residual y values in group 0 are three times residual x; in group 1 they are one times residual x. The sum of residual-x squared is10 and the residual cross-product is20. The residual-on-residual slope is 20/10=2, exactly the full regression's x coefficient.

This is the sample partialling-out identity in the matched OLS setup, not a new experimental design. It tells us which linear variation remains after the specified controls. If almost no x variation remains, separate slopes may be unstable; if no variation remains, the separate coefficient is not uniquely determined. Imperfect correlation among regressors is not by itself bias, and mutual independence of every regressor is not an OLS requirement. Exogeneity and the model's conditional interpretation are different questions.

Dropping D here produces simple-regression slope 62/21≈2.95238 and intercept 55/6≈9.16667. The larger simple slope combines within-group patterns with between-group differences. Calling the controlled 2 a causal effect still requires a defensible argument about assignment, omitted factors and the counterfactual. The algebra shows conditional association and a decomposition; it does not prove that changing x by one causes y to rise by two.

Rank, overlap and the actual contrast

Add another regressor w=2x. Then the coefficient on x and twice the coefficient on w appear only through their sum. Both(b1=2,bw=0)and(b1=0,bw=1) generate the same fitted x contribution. There is no unique pair of separate coefficients. A routine returning one arbitrary solution does not create information that distinguishes them. The exact training laboratory detects rank deficiency rather than hiding it by adding a small number to the matrix.

The dataset also lacks x overlap between groups: D=0 has x from 0 to 3,while D=1 has x from 4 to 7. The additive group coefficient 5 is a model-based contrast holding x fixed, but the data do not observe both groups at the same x. Adding a control or centering x does not create that comparison. An intervention that also changes service scope, customer mix or timing may not correspond to a coefficient's hold-the-other-columns-fixed contrast.

Report a jointly relevant fitted contrast, with units and covariance, rather than read a table one coefficient at a time. A policy raising xand changing Dcan require a combination of coefficients and may cross unsupported regions. For real floating-point analysis, conditioning and appropriate numerical methods matter; the small exact-fraction laboratory is a transparent teaching calculation, not a claim that forming an inverse of normal equations is the best general production solver.

Worked example: Reconstruct the normal equations

For b=(10,2,5), the first equation is8×10+28×2+4×5=156. The second is28×10+140×2+22×5=670. The third is4×10+22×2+4×5=104. All residual-design cross-products vanish. This verifies the least-squares solution for the supplied full-rank design. It does not verify a sampling assumption, causal model or future regime. A reproducible report should preserve the input rows and units so this check can be repeated.

Worked example: A combined fitted contrast needs covariance

Under a separately stipulated homoskedastic calculation for the additive model, residual variance estimate is10/(8−3)=2. The estimated variance of b1 is.2,of b2 is4.2 and their covariance−.8. For a hypothetical contrast increasing x by 1 and D by 1,the fitted change is7 and its calculated variance is.2+4.2+2(−.8)=2.8,so SE≈1.67332. Ignoring covariance gives 4.4 instead. This is conditional uncertainty arithmetic, not a justified causal group-switch policy; the dataset's lack of overlap and interaction pattern still require criticism.

Progressive optional practice

Attempt each problem before opening its model. Then revise the reasoning under the changed conditions.

Reproduce

Use the eight-row data to recover b=(10,2,5)and residual sum of squares. What does the result establish?

Compare the model reasoning

It establishes the unique additive least-squares fit, with SSE 10 and normal-equation orthogonality. It does not establish exogeneity or a correct conditional mean.

Changed conditions

A duplicate column w=2x is added.

Compare the revised analysis

The separate x/w coefficients are not uniquely identified by the design. Remove/redefine redundant columns or state the nonuniqueness; do not report arbitrary software values as distinct effects.

Interpret

Why does the simple slope 62/21 differ from the controlled slope 2?

Compare the model reasoning

The simple relation mixes within-group and between-group variation. Partialling out the intercept/Dgives cross-product 20 over squared residual-x10. Neither is automatically a causal estimate.

Changed conditions

A randomized intervention supplies independent xvariation within each group and a credible measurement plan.

Compare the revised analysis

That new design can support a specified causal contrast under its assumptions; verify implementation, overlap and outcome definition instead of treating the old observational coefficient as newly causal.

Transfer

What is wrong with calling b2=5a directly observed same-xgroup difference in these data?

Compare the model reasoning

Group x ranges do not overlap. The fitted contrast uses functional-form extrapolation rather than a same-x comparison observed in both groups.

Changed conditions

New data include both groups throughout the same relevant x range.

Compare the revised analysis

Reassess support and fit using those data. Overlap helps define comparisons but does not alone remove confounding or measurement problems.

Current development backlog and remaining course work · Course content review

Source readings and scope

Introductory Business Statistics 2e — 13.1 The Correlation Coefficient r — Optional preserved methodological provenance. Complete current on-site studios and preserved full original applications supply all required teaching. Data and estimates are synthetic; they do not describe actual customers or learner records. Statistical relationships do not establish causal, legal or professional approval. Florida is the state-law default; federal rules remain federal and historical other-state examples are comparative. No source affiliation or independent review of this course is claimed.

Introductory Business Statistics 2e — 13.4 The Regression Equation — Optional preserved methodological provenance. Complete current on-site studios and preserved full original applications supply all required teaching. Data and estimates are synthetic; they do not describe actual customers or learner records. Statistical relationships do not establish causal, legal or professional approval. Florida is the state-law default; federal rules remain federal and historical other-state examples are comparative. No source affiliation or independent review of this course is claimed.

NIST/SEMATECH — Linear Least Squares Regression — Optional preserved methodological provenance. Complete current on-site studios and preserved full original applications supply all required teaching. Data and estimates are synthetic; they do not describe actual customers or learner records. Statistical relationships do not establish causal, legal or professional approval. Florida is the state-law default; federal rules remain federal and historical other-state examples are comparative. No source affiliation or independent review of this course is claimed.

MIT OCW — Least Squares and Partialling Out, lecture 1 — Optional sections2–3 provenance for projection and partialling out; complete original on-site derivations and preparation are supplied. Later high-dimensional inference is beyond this unit. The Academy dataset and worked derivations are original synthetic material; no source affiliation or review is claimed.

Reproduce the worked examples in Python 3. Standard library only; synthetic data; no production records or network access.