WEEK 3 · QUESTION 1 · 74 CARS

Are foreign cars more expensive?

Different groups. Equal weight. Different slopes.

DomesticForeignSolid = fit · Dashed edges = 95% uncertainty

But the groups do not have the same average weight.

Before you control: make a prediction.

Foreign cars are lighter; heavier cars tend to cost more. At equal weight, will the foreign–domestic price gap be…

Why does weight matter?

Foreign goes with lighter; heavier goes with pricier. Those two associations mask part of the same-weight price gap.

Without weight control

Different average weights.
The raw comparison mixes both associations.

With weight control

Compare at the same weight.
The weight difference is accounted for.

These are association diagrams, not causal DAGs. A control changes the comparison—not the cars. It does not by itself establish cause and effect.

How the comparison is calculated

The first model is price = a + b × foreign. Domestic = 0, foreign = 1, so b is the difference between group mean prices.

“Same weight” fits price = a + b × foreign + c × weight. On the original axes, the domestic line is a + c × weight; the foreign line is a + b + c × weight. Their common slope is c, and their vertical gap is b. Comparing the lines at one weight is a same-weight comparison. These are two lines from one regression, not separate regressions.

“Interaction” adds d × foreign × weight. The domestic slope remains c; the foreign slope becomes c + d. Panels 2 and 3 use the same original axes, scale, and dots: adding the interaction lets the lines tilt differently. The interaction fit equals separate within-group regressions.

“Show residual view” under “Same weight” displays exactly the same controlled model in another way. Regress price on weight and an intercept, retaining its residuals; separately do the same for foreign. Plot the price residuals against the foreign residuals. The line through zero has exactly the foreign coefficient b from the full controlled model (the Frisch–Waugh–Lovell result). On the original axes b is a vertical gap; on the residual axes b is the slope.

Residual means “observed minus predicted from weight alone”. The residual of foreign is no longer 0 or 1; it can be negative. Colours still represent actual origin, and all 74 cars remain. The residual plot uses different axes and scales; compare numerical coefficients, not angles. Returning to “Same weight” selects the original axes to keep its transition to “Interaction” consistent.

Dashed edges on the original axes are pointwise 95% confidence intervals for the fitted mean, not prediction intervals for individual cars or simultaneous bands. In the residual view they trace the full model’s 95% slope interval through the origin: y = (b ± t × SE(b))x. This slope-uncertainty envelope necessarily narrows to zero at x = 0; it is not a prediction band.

All estimates, p-values and confidence intervals use all 74 cars and HC1 robust covariance matrices with the original model’s residual degrees of freedom (72, 71, and 70). In particular, the residual view uses uncertainty from the full controlled regression, not a naïve refit with the wrong degrees of freedom. Interaction bands also use the combined model’s covariance matrix.

Do not infer significance from overlap between fitted-line bands. The foreign coefficient is $312 without weight control (p = 0.658) and $3,637 with weight control (p < 0.001). The interaction tests the difference in slopes (p = 0.002). “Not significant” means insufficient evidence of a nonzero coefficient, not proof of no difference.

In the first view, horizontal jitter separates overlapping dots; it does not affect the regression. The line between 0 and 1 is visual interpolation between group means—there are no intermediate-origin cars. On price–weight axes, each line and its band stop at that group’s observed weight range.

In these data, corr(foreign, weight) = −0.593 and corr(weight, price) = +0.539. The algebra of the omitted-variable comparison gives: raw origin gap = same-weight origin gap + weight coefficient × difference in group mean weights. Here, $312 ≈ $3,637 + $3.321 × (−1,001 lb). This identity explains the shift without establishing causality.

The undirected diagrams show associations, not a causal model. Their faded connections indicate relationships accounted for by weight adjustment, not associations that vanish in the original data. Calling weight a causal confounder would require additional assumptions. The exercise demonstrates statistical adjustment.

The draggable comparison is restricted to the overlap of observed weight ranges (1,800–3,420 lb). Overlap does not guarantee many cars at each weight. Moving the line reads predictions from the same fitted model; it does not change the sample or refit the regression. Both original-axis models share the same plotting scale.

Based on the Week 3 car-price exercise using Stata’s auto dataset. Course materials are available separately through KEATS. The demo works offline.