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.

 spreg.OLS(y, x[, w, robust, gwk, sig2n_k, …]) Ordinary least squares with results and diagnostics. spreg.ML_Lag(y, x, w[, method, epsilon, vm, …]) ML estimation of the spatial lag model with all results and diagnostics; [Ans88] spreg.ML_Error(y, x, w[, method, epsilon, …]) ML estimation of the spatial error model with all results and diagnostics; [Ans88] spreg.GM_Lag(y, x[, yend, q, w, w_lags, …]) Spatial two stage least squares (S2SLS) with results and diagnostics; Anselin (1988) [Ans88] spreg.GM_Error(y, x, w[, vm, name_y, …]) GMM method for a spatial error model, with results and diagnostics; based on Kelejian and Prucha (1998, 1999) [KP98] [KP99]. spreg.GM_Error_Het(y, x, w[, max_iter, …]) GMM method for a spatial error model with heteroskedasticity, with results and diagnostics; based on [ADKP10], following [Ans11]. spreg.GM_Error_Hom(y, x, w[, max_iter, …]) GMM method for a spatial error model with homoskedasticity, with results and diagnostics; based on Drukker et al. spreg.GM_Combo(y, x[, yend, q, w, w_lags, …]) 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]. spreg.GM_Combo_Het(y, x[, yend, q, w, …]) GMM method for a spatial lag and error model with heteroskedasticity and endogenous variables, with results and diagnostics; based on [ADKP10], following [Ans11]. spreg.GM_Combo_Hom(y, x[, yend, q, w, …]) GMM method for a spatial lag and error model with homoskedasticity and endogenous variables, with results and diagnostics; based on Drukker et al. spreg.GM_Endog_Error(y, x, yend, q, w[, vm, …]) GMM method for a spatial error model with endogenous variables, with results and diagnostics; based on Kelejian and Prucha (1998, 1999) [KP98] [KP99]. spreg.GM_Endog_Error_Het(y, x, yend, q, w[, …]) GMM method for a spatial error model with heteroskedasticity and endogenous variables, with results and diagnostics; based on [ADKP10], following [Ans11]. spreg.GM_Endog_Error_Hom(y, x, yend, q, w[, …]) GMM method for a spatial error model with homoskedasticity and endogenous variables, with results and diagnostics; based on Drukker et al. spreg.TSLS(y, x, yend, q[, w, robust, gwk, …]) Two stage least squares with results and diagnostics. spreg.ThreeSLS(bigy, bigX, bigyend, bigq[, …]) User class for 3SLS estimation

Discrete Choice Models¶

 spreg.Probit(y, x[, w, optim, scalem, …]) 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.

 spreg.OLS_Regimes(y, x, regimes[, w, …]) Ordinary least squares with results and diagnostics. spreg.ML_Lag_Regimes(y, x, regimes[, w, …]) ML estimation of the spatial lag model with regimes (note no consistency checks, diagnostics or constants added) [Ans88]. spreg.ML_Error_Regimes(y, x, regimes[, w, …]) ML estimation of the spatial error model with regimes (note no consistency checks, diagnostics or constants added); [Ans88] spreg.GM_Lag_Regimes(y, x, regimes[, yend, …]) Spatial two stage least squares (S2SLS) with regimes; [Ans88] spreg.GM_Error_Regimes(y, x, regimes, w[, …]) GMM method for a spatial error model with regimes, with results and diagnostics; based on Kelejian and Prucha (1998, 1999) [KP98] [KP99]. spreg.GM_Error_Het_Regimes(y, x, regimes, w) GMM method for a spatial error model with heteroskedasticity and regimes; based on Arraiz et al [ADKP10], following Anselin [Ans11]. spreg.GM_Error_Hom_Regimes(y, x, regimes, w) GMM method for a spatial error model with homoskedasticity, with regimes, results and diagnostics; based on Drukker et al. spreg.GM_Combo_Regimes(y, x, regimes[, …]) 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]. spreg.GM_Combo_Hom_Regimes(y, x, regimes[, …]) GMM method for a spatial lag and error model with homoskedasticity, regimes and endogenous variables, with results and diagnostics; based on Drukker et al. spreg.GM_Combo_Het_Regimes(y, x, regimes[, …]) 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]. spreg.GM_Endog_Error_Regimes(y, x, yend, q, …) 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]. spreg.GM_Endog_Error_Hom_Regimes(y, x, yend, …) GMM method for a spatial error model with homoskedasticity, regimes and endogenous variables. spreg.GM_Endog_Error_Het_Regimes(y, x, yend, …) 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].

Seemingly-Unrelated Regressions¶

Seeimingly-unrelated regression models are a generalization of linear regression. These models (and their spatial generalizations) allow for correlation in the residual terms between groups that use the same model. In spatial Seeimingly-Unrelated Regressions, the error terms across groups are allowed to exhibit a structured type of correlation: spatail correlation.

 spreg.SUR(bigy, bigX[, w, regimes, …]) User class for SUR estimation, both two step as well as iterated spreg.SURerrorGM(bigy, bigX, w[, regimes, …]) User class for SUR Error estimation by Maximum Likelihood spreg.SURerrorML(bigy, bigX, w[, regimes, …]) User class for SUR Error estimation by Maximum Likelihood spreg.SURlagIV(bigy, bigX[, bigyend, bigq, …]) User class for spatial lag estimation using IV spreg.ThreeSLS(bigy, bigX, bigyend, bigq[, …]) User class for 3SLS estimation

Diagnostics¶

Diagnostic tests are useful for identifying model fit, sufficiency, and specification correctness.

 Calculates the f-statistic and associated p-value of the regression. spreg.t_stat(reg[, z_stat]) Calculates the t-statistics (or z-statistics) and associated p-values. spreg.r2(reg) Calculates the R^2 value for the regression. spreg.ar2(reg) 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]. Jarque-Bera test for normality in the residuals. spreg.breusch_pagan(reg[, z]) Calculates the Breusch-Pagan test statistic to check for heteroscedasticity. Calculates the White test to check for heteroscedasticity. spreg.koenker_bassett(reg[, z]) Calculates the Koenker-Bassett test statistic to check for heteroscedasticity. spreg.vif(reg) Calculates the variance inflation factor for each independent variable. spreg.likratiotest(reg0, reg1) Likelihood ratio test statistic [Gre03] spreg.LMtests(ols, w[, tests]) Lagrange Multiplier tests. spreg.MoranRes(ols, w[, z]) Moran’s I for spatial autocorrelation in residuals from OLS regression spreg.AKtest(iv, w[, case]) Moran’s I test of spatial autocorrelation for IV estimation. spreg.sur_setp(bigB, varb) Utility to compute standard error, t and p-value spreg.sur_lrtest(n, n_eq, ldetS0, ldetS1) Likelihood Ratio test on off-diagonal elements of Sigma spreg.sur_lmtest(n, n_eq, sig) Lagrange Multiplier test on off-diagonal elements of Sigma spreg.lam_setp(lam, vm) Standard errors, t-test and p-value for lambda in SUR Error ML spreg.surLMe(n_eq, WS, bigE, sig) Lagrange Multiplier test on error spatial autocorrelation in SUR spreg.surLMlag(n_eq, WS, bigy, bigX, bigE, …) Lagrange Multiplier test on lag spatial autocorrelation in SUR Checks to see numpy array includes a constant.