learn_spatial_spillovers
learn_spatial_spillovers(
side=10,
beta=1.0,
gamma=0.5,
rho=0.5,
noise=0.5,
n_draws=5000,
seed=0,
)Plant direct and indirect effects, then recover them as LeSage-Pace impacts.
Simulates y = (I - rho W)^-1 (beta x + gamma Wx + eps) on a lattice, so the true impacts are known in closed form — direct = tr[(I-ρW)⁻¹(βI+γW)]/n and total = (β+γ)/(1-ρ) — then estimates a spatial Durbin model with :func:geometrics.analyze_spatial_model and compares its Monte-Carlo impact decomposition against the truth. This is why spatial-model coefficients are read through impacts: β alone is not the marginal effect once feedback via ρ exists.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| side | int | Lattice side length (n = side²). | 10 |
| beta | float | Planted own-place coefficient on x. |
1.0 |
| gamma | float | Planted neighbor coefficient on Wx (drives spillovers alongside ρ). |
0.5 |
| rho | float | Planted spatial-lag parameter, |ρ| < 1. | 0.5 |
| noise | float | Standard deviation of the innovation. | 0.5 |
| n_draws | int | Monte-Carlo draws behind the estimated impact standard errors. | 5000 |
| seed | int | Random seed (also passed to the estimator’s Monte-Carlo step). | 0 |
Returns
| Name | Type | Description |
|---|---|---|
| SandboxResult | df (direct/indirect/total, estimated vs true), fig, summary, topic and the simulated cross-section in data. |
Examples
import geometrics as gm
res = gm.learn_spatial_spillovers(rho=0.7)
res.df