Spatial Error Models
Models placing the dependence in the disturbance rather than in y.
SpatialEconometrics.SpatialErrorModel.SpatialErrorPanelModel — Type
SpatialErrorPanelModelA fitted spatial error panel, returned by the panel method of fit_spatial_error.
As SpatialErrorRegressionModel, with the fixed-effects specification and the panel dimensions N and T_per recorded alongside.
SpatialEconometrics.SpatialErrorModel.SpatialErrorRegressionModel — Type
SpatialErrorRegressionModelA fitted cross-sectional spatial error model, returned by fit_spatial_error. Implements the StatsAPI.RegressionModel interface.
Carries coef and vcov for the regression parameters, the spatial error parameter lambda with its standard error, sigma2, loglik, the weight matrix, residuals and coefnames.
SpatialEconometrics.SpatialErrorModel.fit_spatial_error — Function
fit_spatial_error(W, X, y; method, varnames, lambda_bounds)
fit_spatial_error(fe_spec, W, X, y, N, T_per; method, varnames, lambda_bounds)Fit a spatial error model by concentrated maximum likelihood.
\[y = X*beta + u, u = lambda*W*u + e\]
Dependence is in the disturbance rather than in y. OLS stays unbiased under this process but its standard errors are wrong, so the gain is inferential: beta is interpretable as it stands, with no spillover decomposition needed.
The likelihood is concentrated by spatially filtering y and X with (I - lambda*W) at each trial lambda, then maximizing over lambda alone.
The first method fits a cross-section; the second fits a panel, taking a FixedEffectsSpec and the panel dimensions, with X and y stacked units-fastest.
Arguments
W:N x Nsparse weight matrix.X: covariates without an intercept — one is added.y: response.
Keywords
method: aLogDetMethod.varnames: covariate names.lambda_bounds: search interval forlambda, default(-0.995, 0.995).
Returns
A SpatialErrorRegressionModel or SpatialErrorPanelModel.
Examples
m = fit_spatial_error(W, X, y; varnames = ["income", "density"])
m.lambda
coef(m) # directly interpretable
fit_spatial_error(TwoWayFE(), W, X, y, N, T_per)Use lm_tests to decide between this and fit_spatial before fitting either.
References
Anselin, L. (1988). Spatial Econometrics: Methods and Models. Kluwer.