Spatial Dynamic Panel — Interactive Lab

A pedagogical companion to Spatial Dynamic Panel Data Modeling in R: Cigarette Demand Across US States ↗ Back to the post

Spatial spillovers and habit persistence in cigarette demand

When one US state raises its cigarette tax, smokers near the border may drive next door to buy cheaper packs. That cross-border shopping makes consumption in any state depend on its neighbours' prices, not just its own. Add the fact that smoking is highly persistent (τ ≈ 0.86), and the right model has to handle space and time at once — that is what SDPDmod does.

This app lets you turn the dials yourself. In four tabs you will watch a spatial shock ripple across a 1-D ring of states, simulate a spatial-dynamic panel and recover ρ and τ from the data, explore the post's real direct/indirect/total decomposition for the 46-state Cigar panel (1963–1992), and see how the spatial multiplier 1/(1−ρ) and temporal multiplier 1/(1−τ) jointly amplify policy shocks.

How a spatial shock spreads — the geometric series (I − ρW)−1

A spatial autoregressive (SAR) model implies that a 1-unit shock to one state's consumption echoes through its neighbours, then its neighbours' neighbours, in geometric powers of ρW. The animation below shows a 12-state ring where one state is hit by a unit shock; each frame plays one round of the geometric series. The orange total at each state at convergence is the column of (I − ρW)−1 — exactly the object that the post's impact decomposition uses.

Drag the ρ slider below to change the spillover intensity. With ρ near 0 the shock stays put. With ρ near 1 it propagates indefinitely and the column sum explodes — the spatial multiplier 1/(1−ρ) diverges.

Strength of the spillover. The post estimates ρ ≈ 0.16 (dynamic SDM) to 0.30 (SAR, individual FE).
Slow it down to watch each round of ρW · Δy.
Tab 2

Spatial-Dynamic Simulator

Set the true ρ, τ, and W·X spillover, simulate a 46×30 panel, and watch the static SDM and dynamic SDM each try to recover them.

Tab 3

Effect Decomposition

The post's headline forest plot. Toggle effect type (direct/indirect/total) and horizon (static vs short-run vs long-run) for price and income.

Tab 4

Multiplier Explorer

Slide ρ and τ to see how the spatial multiplier 1/(1−ρ) and temporal multiplier 1/(1−τ) blow up the short-run effect into the long-run.

Glossary (open a card if a term is unfamiliar)

Spatial weight matrix W
An n×n matrix encoding which units (states) are neighbours. Row-normalised so Wy equals the average of a state's neighbours' values.
Spatial autoregressive coefficient ρ
Strength of the spillover in y: how much your neighbours' outcomes shape yours. In the post, ρ ranges from 0.16 to 0.30 across specifications.
SAR vs SDM vs SEM
SAR adds ρWy; SDM also adds WXθ (spatial lag of regressors); SEM moves the spatial term into the error.
Lee-Yu bias correction
A small-sample correction for fixed-effects MLE in spatial panels. In the post it nudges ρ from 0.223 up to 0.262 — a 17% upward correction.
Habit persistence τ
Coefficient on yt−1. In this post τ ≈ 0.864 — cigarette demand is extremely sticky.
Direct effect
Full impact of own-state x on own-state y, including the feedback loop i → j → i. The post's static SDM direct price effect is −1.01.
Indirect (spillover) effect
Effect of a neighbour's x on your y. Zero in non-spatial models. Reverses sign between the static and dynamic SDM in this post.
Long-run multiplier 1/(1−τ)
With persistence τ ≈ 0.86, a one-period shock cumulates to 1/(1−0.86) ≈ 7.2× its short-run size. Drives the post's long-run price elasticity to −1.93.

Spatial-dynamic simulator — set the truth, recover it

The data-generating process is a spatial dynamic panel: yt = ρWyt + τyt−1 + βxt + φWxt + αi + γt + εt on a 12-state ring (queen contiguity). You set the true (ρ, τ, β, φ). The app fits a non-spatial FE model, a static SDM, and a dynamic SDM, and reports each one's parameter recovery so you can see which models bias which parameters.

Post estimate: 0.16 (dynamic SDM, LY).
Post estimate: 0.864. Slide to 0 to remove persistence.
Short-run price elasticity. Post estimate: −0.271.
Cross-border price spillover. Post estimate: +0.196 — positive ⇒ cross-border shopping.
The Cigar panel has T = 30. Shorter T inflates the Lee-Yu bias.
Residual standard deviation. Larger σ ⇒ harder to identify spatial effects.

Non-spatial Two-way FE

Ignores W. The model most applied researchers would start with.

ρ̂— (set to 0)
τ̂— (set to 0)
β̂
φ̂— (set to 0)
RMSE on β

Static SDM (TW FE, LY)

Adds ρWy and WXθ. No temporal lag.

ρ̂
τ̂— (set to 0)
β̂
φ̂
RMSE on β

Dynamic SDM (TW FE, LY)

Full model: ρWy + τyt−1 + WXθ.

ρ̂
τ̂
β̂
φ̂
RMSE on β

What to look for

  • Crank τ up. When habit persistence is strong, the static SDM's β̂ becomes badly biased because the omitted yt−1 term is collinear with the spatial lag. Only the dynamic SDM recovers β.
  • Crank ρ up. The non-spatial FE absorbs spatial dependence into β̂, inflating its magnitude. The static SDM partially fixes this; the dynamic SDM fully does.
  • Set φ ≠ 0. Only the SDM specifications include W·x. The non-spatial FE will miss it entirely, biasing β̂ in proportion to φ.
  • Shrink T. Watch how all estimators degrade. Short panels need the Lee-Yu correction.

Effect decomposition — the post's headline forest plot

These numbers come straight from the post's static-SDM and dynamic-SDM impact decompositions for the 46 US states. Toggle effect type (direct / indirect / total) and variable (price / income) to compare. Hover any point to see its SE and 95% CI. The interesting story is the sign reversal of the indirect price effect between the static SDM (−0.22) and the dynamic short-run (+0.18) — that is the cross-border shopping signal that the static model misses.

Variables

Effect type

Model / horizon

What to look for

  • Sign-flip of the indirect price effect. Static SDM: −0.22 (negative spillover). Dynamic short-run: +0.18 (positive — cross-border shopping). The static model conflates spatial and temporal effects.
  • Long-run effects are huge but imprecise. The dynamic long-run direct price elasticity is −1.93 — nearly 2× the static SDM — but the indirect and total long-run estimates have very wide CIs.
  • Income is more robust. The direct income elasticity is positive and significant in every specification (0.10 short-run → 0.59 static → 0.80 long-run). Cigarettes are a normal good.
  • Short-run total price effect is essentially zero. Direct (−0.26) is offset by Indirect (+0.18), leaving Total at −0.08, not significant. Cross-border shopping cancels the within-state effect in the short run.

Why the sign reversal? Cross-border shopping in one minute

When state i raises its price, two things happen in opposite directions. Inside state i, fewer packs are sold (the direct negative effect). Outside state i, neighbouring residents who used to cross the border away now stop — and own-state residents may cross toward a neighbour with lower prices. The static SDM, with no time dimension, ties the spatial lag of price to current neighbour-consumption (which fell because of the spatial multiplier), producing a negative indirect effect. The dynamic SDM, by contrast, lets yt−1 absorb the spatial-multiplier contagion and leaves the W·logp coefficient to reflect the true behavioural channel — cross-border purchasing — which is positive.

Multiplier explorer — how ρ and τ inflate a policy shock

A 1% price hike does not stay where you put it. Spatial spillovers propagate it across neighbours (multiplied by 1/(1−ρ)), and habit persistence accumulates it over time (multiplied by 1/(1−τ)). The two multipliers combine to translate a tiny short-run elasticity into a much bigger long-run one — the source of the post's headline −0.26 short-run vs −1.93 long-run contrast.

Post's dynamic-SDM estimate is 0.162. Slide to see the spatial multiplier explode as ρ → 1.
Post estimate: 0.864. Cigarettes are extremely sticky.
Direct, contemporaneous coefficient on logp from the dynamic SDM.
Positive ⇒ neighbours' higher prices boost own consumption (cross-border shopping).
Spatial multiplier 1/(1−ρ)
how a contemporaneous shock spreads spatially
Temporal multiplier 1/(1−τ)
how a shock accumulates over time
Short-run direct β
immediate own-state response
Long-run direct ≈ β / (1−τ)
cumulative own-state response
Short-run indirect φ
cross-border, one period
Long-run indirect ≈ φ / (1−τ)
cumulative cross-border effect

What to look for

  • τ = 0.864 gives a multiplier of ≈ 7.4. A one-period direct effect of −0.27 grows to ≈ −2.0 in the long run — close to the post's −1.93 estimate.
  • ρ matters less than τ. With ρ = 0.16, the spatial multiplier is only 1/(1−0.16) ≈ 1.19. The temporal multiplier dominates.
  • Slide τ to 0. Long-run and short-run collapse to the same number — the static SDM regime.
  • Slide ρ above 0.9. The spatial multiplier diverges, illustrating why ρ must stay below 1 for the model to make sense.

The general formula for the dynamic spatial multiplier

The full long-run impact matrix for a one-unit change in x across all states is (1 − τ)−1 · (I − ρW)−1 · (βI + φW). The diagonal of that matrix gives the long-run direct effect; the row-sums minus the diagonal give the long-run indirect. The temporal factor 1/(1−τ) is what makes the post's long-run elasticities so much larger than the static ones — and the off-diagonals of (I − ρW)−1 are what produce non-zero spillovers even when φ = 0.