Spatial Panel Regression — Interactive Lab

A pedagogical companion to Spatial Panel Regression in Stata: Cigarette Demand Across US States ↗ Back to the post

Why spatial panel models? Cigarettes do not stop at state lines.

When a state raises its cigarette tax, consumers near state borders may simply drive across to buy cheaper cigarettes next door. Cross-border shopping makes each state's consumption depend not only on its own prices and income but also on those of its neighbours. Ordinary panel models — pooled OLS, region FE, two-way FE — treat each state as independent and miss this spatial spillover.

The Baltagi cigarette panel covers 46 US states across 1963–1992 (n = 1,380). The post estimates a Spatial Durbin Model (SDM) with ρ̂ = 0.265 and an indirect price effect (−0.314) almost as large as the direct one (−0.313). This app lets you turn the dials yourself. Watch a price shock propagate through a spatial multiplier; trade habit persistence (τ) against spatial dependence (ρ) in a dynamic SDM; and explore the post's full direct/indirect/total table interactively.

The spatial-multiplier intuition

Both ρ (spatial lag of y) and τ (temporal lag) amplify a shock relative to its bare coefficient. The animation below sweeps a penalty knob (here, the spatial autoregressive parameter) from zero to one. The orange curve mimics the SDM-type multiplier 1 / (1 − ρ) behaviour (amplifies); the steel dashed curve shows the complementary direction (compression as the penalty grows).

Tab 2

Cross-Border Spillover

Drop a price hike on a 7×7 lattice of "states". Watch the spatial multiplier (I − ρW)−1 propagate it to neighbours and neighbours' neighbours. Vary ρ — see the 0.27 SDM world versus a near-unit world.

Tab 3

Dynamic SDM Simulator

Trade habit persistence τ against spatial dependence ρ. Generate fake panel data on a 7×7 lattice with known τ, ρ, and θ. See why adding τ ≈ 0.65 collapses ρ̂ from 0.27 to 0.08.

Tab 4

Direct / Indirect / Total Effects

The post's headline numbers as a forest plot. Toggle models (Pooled OLS, FE, SDM, dynamic SDM) and regressors (logp, logy). See why non-spatial models understate price sensitivity by 57%.

The three key takeaways this app is built around

  1. Non-spatial models understate price sensitivity. Two-way FE gives a price elasticity of −0.402; SDM total effect is −0.627 — a 57% increase. The difference is the cross-border spillover ignored by standard panel models. The OLS-vs-SDM gap is the cross-border-shopping channel made visible.
  2. The SDM cannot be simplified. All three Wald tests reject the simpler models: SAR (χ² = 12.87, p = 0.002), SLX (χ² = 61.04, p < 0.001), SEM (χ² = 8.49, p = 0.014). Cigarette consumption spills across borders through three channels at once: neighbours' consumption (ρ), neighbours' prices (θlogp), and neighbours' income (θlogy).
  3. Habit persistence dominates dynamics. Adding the temporal lag τ collapses ρ̂ from 0.265 to 0.080 and produces τ̂ = 0.654 — about 65% of last year's smoking persists. The static SDM conflates temporal and spatial dynamics. Short-run elasticity drops to −0.15; long-run is approximately −0.42 = −0.15 / (1 − 0.64).

Glossary (open a card if a term is unfamiliar)

Spatial Durbin Model (SDM)
The most general spatial specification: y = ρWy + Xβ + WXθ + μ + λ + ε. Includes spatial lags of both the dependent variable and the regressors. Nests SAR (θ = 0), SLX (ρ = 0), and SEM (common factor restriction).
ρ (rho) — spatial autoregressive
Coefficient on Wy. Measures how strongly a state's consumption moves with its neighbours'. In the post, ρ̂ = 0.265 in the static SDM; collapses to 0.080 once habit persistence is controlled for.
τ (tau) — temporal lag
Coefficient on yi,t−1. Measures own habit persistence. Cigarettes are addictive — last year's consumption is the strongest single predictor of this year's. τ̂ ≈ 0.65 in the full dynamic SDM.
ψ (psi) — spatiotemporal lag
Coefficient on W·yt−1: neighbours' past consumption. Significant alone (ψ̂ = 0.27) but loses significance once own habit persistence τ is included.
W — spatial weight matrix
Binary contiguity (states share a border = 1, else 0), row-standardised so each row sums to 1. The spatial lag Wy is then a weighted average of neighbours' values, not a sum.
Direct effect
∂yi/∂xi: marginal impact of a state's own regressor on its own outcome, including spatial feedback through neighbours and back. In the SDM, the diagonal of (I − ρW)−1 amplifies the bare β by ~1.07.
Indirect (spillover) effect
∂yi/∂xj: marginal impact of state j's regressor on state i's outcome. Zero in OLS and FE by construction. Substantial in SDM: −0.314 for price (almost equal to direct).
Total effect = direct + indirect
The full system response to a one-unit change in x. SDM total price effect is −0.627 = −0.313 (direct) + −0.314 (indirect) — 57% larger in magnitude than two-way FE.
Lee-Yu bias correction
An adjustment for the incidental parameters bias in spatial ML with fixed effects. Uses N×(T−1) = 1,334 obs. In this panel with T = 30, the correction barely moves estimates (ρ̂ from 0.265 to 0.260) — bias is small for long panels.
Wald tests for SDM restrictions
Three joint tests on the SDM parameters. SAR test: θ = 0. SLX test: ρ = 0. SEM test: θ + ρβ = 0 (common factor). All rejected here, so the full SDM is the right specification.
Short-run vs long-run elasticity
In a dynamic model, β is the contemporaneous (short-run) impact. Long-run is β / (1 − τ). With β = −0.15 and τ = 0.64, the long-run elasticity is −0.42 — close to the static SDM's −0.40.

Cross-Border Spillover — watch the price hike propagate

A 7×7 lattice of "states" (49 cells, in the same spirit as the 46-state US panel). Click any cell to drop a unit price hike on it. The animation spreads it through a row-standardised rook spatial weight matrix at rate ρ. After many iterations, the system stabilises at (I − ρW)−1 times the initial shock. Slide ρ to feel the gap between the SDM's ρ̂ = 0.27 and a near-unit-root world.

The static SDM gives ρ̂ = 0.265. The dynamic SDM with τ = 0.65 gives ρ̂ = 0.080. Try both regimes.
Each step propagates the shock by ρ·W to immediate neighbours. ~15 steps suffice for ρ ≤ 0.6.

Click any cell to drop a unit price-hike shock

Heat colour shows the steady-state change in consumption per state. Brighter = stronger spillover received from the shocked state.

multiplier amplification
≈ 1 / (1 − ρ)
states with response > 5% of initial shock
out of 49 cells
max response in any cell
always on the shocked cell itself

What to look for

  • At ρ = 0, the price hike stays in the originating state. No cross-border response. This is the world non-spatial FE assumes.
  • At ρ = 0.27 (the static SDM estimate), the shock bleeds visibly into the 4 contiguous neighbours, then decays geometrically. The amplification 1 / (1 − ρ) ≈ 1.37 matches the SDM's direct/own-coefficient gap (−0.313 / −0.307 ≈ 1.02 once spatial lags of X are accounted for).
  • At ρ = 0.08 (the dynamic SDM estimate), the spatial map is much darker. Spillovers are real but small once habit persistence is controlled for. The static model overstates them by absorbing temporal autocorrelation.
  • At ρ ≥ 0.8, every cell lights up. The entire panel becomes a single interconnected system. The cigarette panel is decisively not in this regime.

Dynamic SDM Simulator — trade τ against ρ

Simulate panel data on a 7×7 lattice (n = 49 "states", T = 30 years) with known true habit persistence τ, spatial autoregression ρ, and a price-lag spillover θ. Then estimate ρ̂ back from a misspecified static SDM that ignores τ. Watch ρ̂ inflate as the true τ grows — the static SDM's bias absorbs habit persistence into the spatial parameter. This is the §8 finding of the post made visible.

Cigarettes are addictive: the post estimates τ̂ ≈ 0.65. Try 0 (no habit) to 0.85 (very persistent).
The dynamic SDM finds ρ̂ = 0.080 (small spatial spillover once habit is controlled). Static SDM finds 0.265.
The post's SDM gives θ̂logp = −0.206 (neighbour-price spillover). Cross-border-shopping channel.
The SDM's σ̂² = 0.0028 ⇒ σ̂ ≈ 0.053. Larger σ = noisier estimates.

Truth what we simulated

true τ (habit)
true ρ (spatial)
true θlogp
noise σ

Estimates what each model recovers

Pedagogical estimators on simulated data — concentrated profile likelihood for ρ on a grid. Not as accurate as Stata's xsmle, but the bias pattern is the same.

ρ̂ from static SDM (ignores τ)
ρ̂ from dynamic SDM (with τ)
τ̂ from dynamic SDM
bias gap |ρ̂static − ρ̂dyn|

What to look for

  • Set τ = 0 and ρ = 0.27: data is purely cross-sectional in dynamics. Both static and dynamic SDM recover ρ ≈ 0.27. No bias from omitting the temporal lag.
  • Set τ = 0.65 and ρ = 0.08: the post's regime. The static SDM should now estimate ρ̂ inflated toward ~0.25 — it absorbs the τ-driven inertia into the spatial parameter. The dynamic SDM separates them correctly.
  • Set τ = 0.85 and ρ = 0: a purely habit-driven world with no genuine spatial spillover. The static SDM will still produce a large ρ̂ — it has nowhere else to put the temporal correlation. This is the §8 false-positive trap.
  • Read the gap stat: the larger the gap between static and dynamic ρ̂, the worse the static model misspecifies the dynamics. In the cigarette panel, the gap is about 0.18 (0.265 − 0.080).

The post's headline numbers — interactively

These estimates come straight from the post — §4 (Pooled OLS, Region FE, Time FE, Two-way FE), §6 (SDM standard and SDM with Lee-Yu bias correction), and §8 (Dynamic SDM with τ alone and with both τ + ψ). The y-axis lists the eight models. The facets are the three impact components: direct, indirect (spillover), and total. Toggle which models and which regressor (logp or logy) to display.

What to look for

  • Toggle non-spatial models (Pooled OLS, Region FE, Time FE, Two-way FE): notice that the indirect-effect facet is uniformly zero. These models have no cross-border channel by construction. The Total facet then equals the Direct facet for every non-spatial row.
  • Compare Two-way FE and SDM on logp: two-way FE gives −0.402 (direct = total); SDM gives total = −0.627. The 57% understatement is the cross-border-shopping channel ignored by FE. This is the headline finding of §6 and §9.
  • SDM vs SDM (Lee-Yu): nearly identical (ρ: 0.265 vs 0.260; total logp: −0.627 vs −0.623). With T = 30 the incidental-parameter bias is small. The Lee-Yu correction is a robustness check rather than a substantive correction here.
  • Static SDM vs dynamic SDM on logp: static SDM direct = −0.313; dynamic SDM (with τ) direct = −0.152 — half the size. Dynamic indirect drops from −0.314 to −0.082 (and loses significance). The static SDM's spillover estimates partly capture omitted temporal dynamics.
  • For logy (income): non-spatial Region FE estimates a tiny insignificant 0.013; SDM total = +0.36; dynamic SDM total = +0.11. Once habit persistence is controlled, the income elasticity nearly halves.

Regressor

Models to display

Why does the SDM amplify the price effect but the dynamic SDM shrink it?

In the static SDM, a price hike in state i propagates to neighbours through (I − ρW)−1 and partly echoes back. The direct effect (−0.313) includes the echo, and the indirect effect (−0.314) captures the cross-border response. Total = −0.627, much larger than two-way FE's −0.402 because the FE model has no spatial channel.

In the dynamic SDM, much of what looked like spatial dependence is actually habit persistence — τ̂ ≈ 0.65 — that happens to cluster temporally and spatially because neighbour states are autocorrelated within. Once τ enters the model, ρ̂ collapses from 0.265 to 0.080. The short-run direct effect halves (−0.152), and the long-run effect (β / (1 − τ) = −0.152 / 0.36 ≈ −0.42) matches the static SDM's number from a completely different mechanism: contemporaneous spatial spillover vs. own habit persistence over time.

The Wald-test verdict (post §7)

Three tests, three rejections — the SDM cannot be simplified:

  • SAR restriction (θ = 0): χ²(2) = 12.87, p = 0.002. Neighbours' prices and incomes have direct effects beyond their influence through Wy.
  • SLX restriction (ρ = 0): χ²(1) = 61.04, p < 0.001. The spatial autoregressive feedback is overwhelmingly significant.
  • SEM common-factor restriction (θ + ρβ = 0): χ²(2) = 8.49, p = 0.014. Spatial dependence is substantive, not just nuisance error.

Three independent statistical tests all reject the simpler model. The full SDM is the appropriate specification — cigarette demand spills across borders through multiple channels simultaneously.