API reference¶
Classic Models¶
|
Ordinary least squares with results and diagnostics. |
|
Two stage least squares with results and diagnostics. |
Spatial Regression Models¶
These are the standard spatial regression models supported by the spreg package. Each of them contains a significant amount of detail in their docstring discussing how they’re used, how they’re fit, and how to interpret the results.
|
Spatial two stage least squares (S2SLS) with results and diagnostics; Anselin (1988) [Ans88] |
|
ML estimation of the spatial lag model with all results and diagnostics; [Ans88] |
|
Wrapper function to call any of the GMM methods for a spatial error model available in spreg |
|
ML estimation of the spatial error model with all results and diagnostics; [Ans88] |
|
GMM method for a spatial error model, with results and diagnostics; based on Kelejian and Prucha (1998, 1999) [KP98] [KP99]. |
|
GMM method for a spatial error model with heteroskedasticity, with results and diagnostics; based on [ADKP10], following [Ans11]. |
|
GMM method for a spatial error model with homoskedasticity, with results and diagnostics; based on Drukker et al. (2013) [DEP13], following Anselin (2011) [Ans11]. |
|
GMM method for a spatial lag and error model with endogenous variables, with results and diagnostics; based on Kelejian and Prucha (1998, 1999) [KP98] [KP99]. |
|
GMM method for a spatial lag and error model with heteroskedasticity and endogenous variables, with results and diagnostics; based on [ADKP10], following [Ans11]. |
|
GMM method for a spatial lag and error model with homoskedasticity and endogenous variables, with results and diagnostics; based on Drukker et al. (2013) [DEP13], following Anselin (2011) [Ans11]. |
|
GMM method for a spatial error model with endogenous variables, with results and diagnostics; based on Kelejian and Prucha (1998, 1999) [KP98] [KP99]. |
|
GMM method for a spatial error model with heteroskedasticity and endogenous variables, with results and diagnostics; based on [ADKP10], following [Ans11]. |
|
GMM method for a spatial error model with homoskedasticity and endogenous variables, with results and diagnostics; based on Drukker et al. (2013) [DEP13], following Anselin (2011) [Ans11]. |
|
Estimation of the nonlinear SLX model - inverse distance power function and negative exponential distance function supported Includes output of all results. |
Discrete Choice Models¶
|
Classic non-spatial Probit and spatial diagnostics. |
Regimes Models¶
Regimes models are variants of spatial regression models which allow for structural instability in parameters. That means that these models allow different coefficient values in distinct subsets of the data.
|
Ordinary least squares with results and diagnostics. |
|
Two stage least squares (2SLS) with regimes. |
|
ML estimation of the spatial lag model with regimes (note no consistency checks, diagnostics or constants added) [Ans88]. |
|
ML estimation of the spatial error model with regimes (note no consistency checks, diagnostics or constants added); [Ans88] |
|
Spatial two stage least squares (S2SLS) with regimes; [Ans88] |
|
GMM method for a spatial error model with regimes, with results and diagnostics; based on Kelejian and Prucha (1998, 1999) [KP98] [KP99]. |
|
GMM method for a spatial error model with heteroskedasticity and regimes; based on Arraiz et al [ADKP10], following Anselin [Ans11]. |
|
GMM method for a spatial error model with homoskedasticity, with regimes, results and diagnostics; based on Drukker et al. (2013) [DEP13], following Anselin (2011) [Ans11]. |
|
GMM method for a spatial lag and error model with regimes and endogenous variables, with results and diagnostics; based on Kelejian and Prucha (1998, 1999) [KP98] [KP99]. |
|
GMM method for a spatial lag and error model with homoskedasticity, regimes and endogenous variables, with results and diagnostics; based on Drukker et al. (2013) [DEP13], following Anselin (2011) [Ans11]. |
|
GMM method for a spatial lag and error model with heteroskedasticity, regimes and endogenous variables, with results and diagnostics; based on Arraiz et al [ADKP10], following Anselin [Ans11]. |
|
GMM method for a spatial error model with regimes and endogenous variables, with results and diagnostics; based on Kelejian and Prucha (1998, 1999) [KP98] [KP99]. |
|
GMM method for a spatial error model with homoskedasticity, regimes and endogenous variables. |
|
GMM method for a spatial error model with heteroskedasticity, regimes and endogenous variables, with results and diagnostics; based on Arraiz et al [ADKP10], following Anselin [Ans11]. |
|
Ordinary least squares with endogenous regimes. |
|
Spatial two stage least squares (S2SLS) with endogenous regimes. |
|
Initialize the Skater_reg algorithm based on [AA24]. |
Spatial Panel Models¶
Spatial panel models allow for evaluating correlation in both spatial and time dimensions.
|
ML estimation of the fixed effects spatial lag model with all results and diagnostics [Elh03]. |
|
ML estimation of the fixed effects spatial error model with all results and diagnostics [Elh03]. |
|
ML estimation of the random effects spatial lag model with all results and diagnostics [Elh03]. |
|
ML estimation of the random effects spatial error model with all results and diagnostics [Elh03]. |
|
GMM method for a spatial random effects panel model based on Kapoor, Kelejian and Prucha (2007) [KKP07]. |
Diagnostics¶
Diagnostic tests are useful for identifying model fit, sufficiency, and specification correctness.
|
Calculates the f-statistic and associated p-value for multiple coefficient constraints [Gre03]. |
|
Calculates the t-statistics (or z-statistics) and associated p-values. |
|
Calculates the R^2 value for the regression. |
|
Calculates the adjusted R^2 value for the regression. |
|
Calculates the standard error of the regression coefficients. |
|
Calculates the log-likelihood value for the regression. |
|
Calculates the Akaike Information Criterion. |
|
Calculates the Schwarz Information Criterion. |
Calculates the multicollinearity condition index according to Belsey, Kuh and Welsh (1980) [BKW05]. |
|
|
Durbin-Wu-Hausman test on endogeneity of variables |
|
Jarque-Bera test for normality in the residuals. |
|
Calculates the Breusch-Pagan test statistic to check for heteroscedasticity. |
|
Calculates the White test to check for heteroscedasticity. |
|
Calculates the Koenker-Bassett test statistic to check for heteroscedasticity. |
|
Calculates the variance inflation factor for each independent variable. |
|
Likelihood ratio test statistic [Gre03] |
|
Lagrange Multiplier tests. |
|
Moran's I for spatial autocorrelation in residuals from OLS regression |
|
Moran's I test of spatial autocorrelation for IV estimation. |
|
Utility to compute standard error, t and p-value |
|
Likelihood Ratio test on off-diagonal elements of Sigma |
|
Lagrange Multiplier test on off-diagonal elements of Sigma |
|
Standard errors, t-test and p-value for lambda in SUR Error ML |
|
Lagrange Multiplier test on error spatial autocorrelation in SUR |
|
Lagrange Multiplier test on lag spatial autocorrelation in SUR |
|
Checks to see numpy array includes a constant. |
|
Lagrange Multiplier test on lag spatial autocorrelation in panel data. |
|
Lagrange Multiplier test on error spatial autocorrelation in panel data. |
|
Robust Lagrange Multiplier test on lag spatial autocorrelation in panel data. |
|
Robust Lagrange Multiplier test on error spatial autocorrelation in panel data. |
|
Hausman test on panel data with spatial interactions. |
Spatial Specification Search¶
The spsearch module contains tools for conducting incremental specification searches for spatial econometric models following the approach of [ARA]
|
Classic forward specification: Evaluate results from LM-tests and their robust versions from spreg.OLS. |
|
Forward specification: Evaluate results from Koley-Bera LM-tests and their robust versions from spreg.OLS. |
|
Forward specification: Evaluate results from Koley-Bera LM-tests to decide on OLS vs SLX then proceed as in stge_classic. |
|
GETS specification starting with GNS model estimation. |
|
Hybrid specification search: Starting from the estimation of the Spatial Durbin model, |
DGP¶
Tools for simulating synthetic data according to data-generating processes implied by different spatial model specifications
|
make_error: generate error term for a given distribution |
|
make_x: generate a matrix of k columns of x for a given distribution |
|
make_wx: generate a matrix spatially lagged x given matrix x |
|
make_xb: generate a column xb as matrix x (constant added) |
|
make_wxg: generate a column wxg as matrix wx (no constant) |
|
dgp_errproc: generates pure spatial error process |
|
dgp_ols: generates y for non-spatial process with given xb and error term u |
|
dgp_slx: generates y for SLX with given xb, wxg, and error term u |
|
dgp_sperror: generates y for spatial error model with given xb, weights, |
|
dgp_slxerror: generates y for SLX spatial error model with xb, wxg, weights, |
|
dgp_lag: generates y for spatial lag model with xb, weights, |
|
dgp_spdurbin: generates y for spatial Durbin model with xb, wxg, weights, |
|
dgp_lagerr: generates y for spatial lag model with sar or ma errors |
|
dgp_gns: generates y for general nested model with sar or ma errors |
|
dgp_mess: generates y for MESS spatial lag model with xb, weights, |
|
dgp_probit: generates y for non-spatial probit process with given xb |
make_bin: generates y as 0-1 variable for y > mean of y, |
|
|
make_heterror: transforms constant variance error term into |
|
make_vmult : helper function to create variance multiplier |