-------------------------------------------------------------------------------
help: spautoreg                                                        dialog: 
> spautoreg
-------------------------------------------------------------------------------

+-------+ ----+ Title +------------------------------------------------------------

spautoreg: Spatial Cross Sections Regression Models: (Lag-Error-Durbin-SAC-SPGLS-SPGSAR-GS2SLS-GS3SLS-SPML-SPGS-SPIVREG-I > VTobit)

+-------------------+ ----+ Table of Contents +------------------------------------------------

Syntax Options Other Options Description Saved Results References

*** Examples

Acknowledgments Author

+--------+ ----+ Syntax +-----------------------------------------------------------

spautoreg depvar indepvars [if] [in] [weight], wmfile(weight_file) wmat(weight_matrix_name_W) eigw(eig_var_name_eW) [ model(ols|lag|error|durbin|sac|spgls|spgsar|gs2sls|gs3sls|ivtobit > |spml|spgs|spiv)

stand lmspac lmauto lmhet lmnorm lmiden alltest reset dist(norm|exp|weib) mhet(varlist) mfx(lin, log) spar(rho, lam) order(1, 2, 3, 4) wxlag(1, 2, 3, 4) inrho(real 0) inlambda(real 0) wrho(matrix_name_W1) eigwrho(eig_var_name_eW1) predict(new_var) resid(new_var) noconstant nolog robust liml gmm gmm2s cue re nocollin ffirst bw(#) kernel(#) fuller(#) kclass(#) exposure(varname numeric) nolrtest offset(varname numeric) endogtest(varlist_en) orthog(varlist_ex) redundant(varlist_ex) ols 2sls 3sls sure mvreg first twostep grids(#) het impower(#) small level(#) vce(vcetype) ] maximize specify other maximization options constraint apply specified linear constraints

+---------+ ----+ Options +----------------------------------------------------------

options Description -------------------------------------------------------------------------

* wmfile(weight_file) weight matrix file name

* wmat(weight_matrix_name) name of the new spatial weight matrix to be used from importing wmfile(), it has two types; row-standardized, and binary weight matrix.

* eigw(eig_var_name) new eigenvalues variable name

+---------------+ ----+ Other Options +----------------------------------------------------

options Description -------------------------------------------------------------------------

model(ols, lag, error, durbin, sac, spgls, spgsar, spml, spgs, spiv, gs2sls, gs3sls, ivtobit)

stand new row-standardized weight matrix within each row sum equals 1. Default is Binary spatial weight matrix which each element is 0 or 1

order(1, 2, 3, 4) order of lagged independent variables up to maximum 4th order. Default is 1. order(2,3,4) works only with: model(gs2sls, gs3sls, spiv, ivtobit)

wxlag(1, 2, 3, 4) lagged independent variables up to maximum 4th order. Default is 1. order(#) and wxlag(#) must be combined and wxlag(#) must be less than or equal order(#)

wrho(matrix_name) name of spatial weight matrix which will be used when generating spatially lagged dependent variable in the sac model. By default, spatial weight matrix supplied with weights() is used for both spatially lagged dependent variable and spatially lagged disturbances, although there may be identification problems. The two spatial weights must be of the same source, as indicated with wfrom()

eigwrho(varname) eigenvalues variable which must be combined with option wrho(matrix_name) in model(sac)

Note 1: Options wrho() and eigwhro() are necessary when you want to estimate (SAC) spatial model with different spatial weights for autoregressive lag and the autoregressive error terms. When these two options are not specified, spautoreg uses the same spatial weights matrix for both the autoregressive lag and the autoregressive error terms (see examples below)

mfx(lin, log) type of functional form, either Linear model (lin), or Log-Log model (log), to compute Total, Direct, and InDirect Marginal Effects and Elasticities.

- In Linear model marginal effects are the transformed coefficients (Bm), and elasticities are (Es=Bm X/Y).

- In Log-Log model the transformed coefficients are elasticities, and the marginal effects are (Bm =Es Y/X).

spar(rho, lam) type of spatial autoregressive coefficients, (rho) [Rho], and (lam) [Lambda] - mfx( ) and spar( ) must be combined in model(lag, durbin, sac, spml, s > pgs, spiv) - spar(rho) can not be used with model(error) - spar(lam) can not be used with model(lag, durbin) - model(sac, spml, spgs, spiv) work with the two types spar(rho, lam) - model(gs2sls, gs3sls, ivtobit) not work with the two types spar(rho, l > am)

mhet(varlist) If the model has Heteroscedasticity problem in the error term, use this option with model(lag, durbin) to determine variable(s) that will be included in Spatial Multiplicative Heteroscedasticity model

dist(norm, exp, weib) Distribution of error term dist(norm) Normal distribution; Default. dist(exp) Exponential distribution. dist(weib) Weibull distribution.

If the model has non normality problem in the error term, use dist(exp, weib) with model(lag, error, durbin, sac) to remedy non normality problem.

alltest display ALL lma, lmh, lmn, lmsp, lmi, reset tests.

inrho(real 0) set initial value for rho. Default is 0

inlambda(real 0) set initial value for lambda. Default is 0

predict(new_variable) predicted values variable

resid(new_variable) residuals values variable

constraint apply specified linear constraints, work with model(error, sac, spgls, spgsar, gs2sls)

nolog suppress iteration of the log likelihood.

robust Use Huber-White standard errors for model(lag, durbin, gs2sls)

liml in model(gs2sls) Limited Information Maximum Likelihood (LIML)

gmm in model(gs2sls) Generalized Method of Moments (GMM)

gmm2s in model(gs2sls) Two-step feasible GMM

cue in model(gs2sls) Continuously Updated Estimation GMM

rf in model(gs2sls) Reduced form estimation of the equation will be displayed

nocollin in model(gs2sls) Suppresses checks for collinearities and duplicate variables

ffirst in model(gs2sls) Display only first-stage diagnostic and identification tests

fuller(#) in model(gs2sls) Fuller's modified LIML estimator using user-supplied Fuller parameter alpha, a non-negative number. Alpha=1 has been suggested as a good choice

kclass(#) in model(gs2sls) general k-class estimator is calculated using the user-supplied #, a non-negative number

bw(#) in model(gs2sls) AC or HAC covariance estimation with bandwidth equal to #, where # is an integer greater than zero

kernel(string) in model(gs2sls) kernel to be used for AC and HAC covariance estimation; the default kernel is Bartlett (also known in econometrics as Newey-West

coviv in model(gs2sls) Use 2SLS Covariance Matrix for LIML or k-Class

orthog(varlist_ex) in model(gs2sls) C-statistic test of the exogeneity of the instruments in varlist_ex. These may be either included or excluded exogenous variables

endog(varlist_en) in model(gs2sls) C-statistic test of the endogeneity of the endogenous regressors in varlist_en

redundant(varlist_ex) in model(gs2sls) LM test of redundancy of the instruments in varlist_ex. redundant test of whether a subset of excluded instruments is redundant

ols in model(gs3sls) Ordinary Least Squares (OLS)

2sls in model(gs3sls) Two-Stage Least Squares (2SLS)

3sls in model(gs3sls) Three-Stage Least Squares (3SLS)

sure in model(gs3sls) Seemingly Unrelated Regression Estimation (SURE)

mvreg in model(gs3sls) SURE with OLS DF adjustment (MVREG)

allexog in model(gs3sls) all right-hand-side variables are exogenous

first in model(gs2sls, gs3sls, ivtobit) full first-stage regression, diagnostic and identification tests will be displayed

twostep in model(ivtobit) Newey's two-step estimator. Default is MLE

first in model(ivtobit) Report First-Stage Tests

grids(#) in model(spml) Use grid search for initial values of lambda and rho parameters

het in model(spgs, spiv) Use estimator allows for heteroskedastic disturbance terms

impower(#) in model(spgs, spiv) Use q powers of matrix W in forming instrument matrix H (q= 2, 3,...,7) . Default is 2

small in model(gs2sls, gs3sls) Use (F and t-tests) instead of (chi-squared and z-tests)

level(#) confidence intervals level. Default is level(95)

vce(vcetype) vcetype may be ols, robust, cluster clustvar, bootstrap, jackknife, hc2, or hc3

lmspac Spatial Aautocorrelation Tests: * Ho: No Spatial AutoCorrelation - Ha: Spatial AutoCorrelation - GLOBAL Moran MI - GLOBAL Geary GC - GLOBAL Getis-Ords GO - Moran MI Error Test - LM Error - LM Error (Robust) - LM Lag - LM Lag (Robust) - LM SAC (LMErr+LMLag_R) - LM SAC (LMLag+LMErr_R)

Definitions:

- Spatial autocorrelation: chock in one country affects neighboring countrie > s

- Spatial autocorrelation: is correlation of a variable with itself in space > .

- Spatial Lag Model: y = BX + rWy + e ; e = lWe+u - Spatial Error Model: y = BX + e ; e = lWe+u - Spatial Durbin Model: y = BX + aWX* + rWy + e ; e = lWe+u - General Spatial Model: y = BX + rWy + LW1y + e ; e = lW1e+u

- Positive spatial autocorrelation exists when high values correlate with high neighboring values or when low values correlate with low neighboring values

- Negative spatial autocorrelation exists when high values correlate with low neighboring values and vice versa.

- presence of positive spatial autocorrelation results in a loss of informat > ion, which is related to greater uncertainty, less precision, and larger standa > rd errors.

- Spatial autocorrelation coefficients (in contrast to their counterparts in > time) are not constrained by -1/+1. Their range depends on the choice of weights > matrix.

- Spatial dependence exists when the value associated with one location is dependent on those of other locations.

- Spatial heterogeneity exists when structural changes related to location exist in a dataset, it can result in non-constant error variance (heteroscedasticity) across areas, especially when scale-related measurement errors are present.

- Spatial regression models are statistical models that account for the presence of spatial effects, i.e., spatial autocorrelation (or more generally spatial dependence) and/or spatial heterogeneity.

- if LM test for spatial lag is more significant than LM test for spatial er > ror, and robust LM test for spatial lag is significant but robust LM test for spatial error is not, then the appropriate model is spatial lag model. Conversely, if LM test for spatial error is more significant than LM test for spatial lag and robust LM test for spatial error is significant but robust LM test for spatial lag is not, then the appropriate specificat > ion ise spatial error model. Because we often encounter situations when this decision rule cannot be strictly applied. - robust versions of Spatial LM tests are considered only when standard versions (LM-Lag or LM-Error) are significant - General Spatial Model is used to deal with both types of spatial dependenc > e, namely spatial lag dependence and spatial error dependence - Spatial Error Model is used to handle spatial dependence due to omitted variables or errors in measurement through the error term - Spatial Autoregressive Model (SAR) is also known as Spatial Lag Model

lmauto Autocorrelation Tests: * Ho: No AR(1) AutoCorrelation - Ha: AR(1) AutoCorrelation - Durbin h Test (Lag DepVar) Durbin h Test can not be computed, if the square root has negative value - Harvey LM Test (Lag DepVar) - Durbin-Watson Test - Wald t Test (Lag DepVar) - Wald LM Test (Lag DepVar)

diag Model Selection Diagnostic Criteria: - Log Likelihood Function LLF - Akaike Final Prediction Error AIC - Schwartz Criterion SC - Akaike Information Criterion ln AIC - Schwarz Criterion ln SC - Amemiya Prediction Criterion FPE - Hannan-Quinn Criterion HQ - Rice Criterion Rice - Shibata Criterion Shibata - Craven-Wahba Generalized Cross Validation-GCV

lmnorm Non Normality Tests: * Ho: Normality - Ha: Non Normality *** Normality Tests: - Jarque-Bera LM Test - White IM Test - Doornik-Hansen LM Test - Geary LM Test - Anderson-Darling Z Test - D'Agostino-Pearson LM Test *** Skewness Tests: - Srivastava LM Skewness Test - Small LM Skewness Test - Skewness Z Test - Skewness Coefficient - Standard Deviation *** Kurtosis Tests: - Srivastava Z Kurtosis Test - Small LM Kurtosis Test - Kurtosis Z Test - Kurtosis Coefficient - Standard Deviation *** Runs Tests: - Runs Test: - Standard Deviation Runs Sig(k) - Mean Runs E(k) - 95% Conf. Interval [E(k)+/- 1.96* Sig(k)] *** Tobit Non Normality Tests *** LM Test - Ho: No Skewness *** LM test - Ho: No Kurtosis *** LM Test - Ho: Normality (No Kurtosis, No Skewness) - Pagan-Vella LM Test - Chesher-Irish LM Test

lmhet Heteroscedasticity Tests: * Ho: Homoscedasticity - Ha: Heteroscedasticity - Hall-Pagan LM Test: E2 = Yh - Hall-Pagan LM Test: E2 = Yh2 - Hall-Pagan LM Test: E2 = LYh2 - Harvey LM Test: LogE2 = X - Wald Test: LogE2 = X - Glejser LM Test: |E| = X - White Test - Koenker(R2): E2 = X - White Test - B-P-G (SSR): E2 = X - White Test - Koenker(R2): E2 = X X2 - White Test - B-P-G (SSR): E2 = X X2 - White Test - Koenker(R2): E2 = X X2 XX - White Test - B-P-G (SSR): E2 = X X2 XX - Cook-Weisberg LM Test E = Yh - Cook-Weisberg LM Test E = X *** Single Variable Tests - Cook-Weisberg LM Test: E = xi - King LM Test: E = xi *** Tobit Model Heteroscedasticity LM Tests - Separate LM Tests - Ho: Homoscedasticity - Joint LM Test - Ho: Homoscedasticity

lmiden Identification Tests, works only with: model(gs2sls) Sargan LM Test Basmann LM Test

reset REgression Specification Error Tests (RESET) Ramsey RESET2 Test: Y= X Yh2 Ramsey RESET3 Test: Y= X Yh2 Yh3 Ramsey RESET4 Test: Y= X Yh2 Yh3 Yh4 Functional Form White Test: E2= X XX

+-------------+ ----+ Description +------------------------------------------------------

spautoreg it is considered as a complete package for estimating Spatial econometric regression models for Cross Section data, while spxtreg is used for Spatial Panel Data. many types of sptial autocorrelations were taken under consedration, i.e., (Lag - Error - Durbin - SAC - SPGLS - SPGSAR - GS2SLS - GS3SLS - SPML - SPGS - SPIV - IVTobit) Regressions. In addition, spautoreg can fit Continuous and Truncated Dependent Variables models Tobit, also fits Autocorrelation (serial correlation), Heteroscedasticity, and non normal regression models in the disturbance term.

model(lag, error, durbin, sac) deal with the two kinds of data either continuous or truncated dependent variables models. If data have missing values the user must fill in these missing values in ZERO, so in this case model(lag, error, durbin, sac) will fit spatial model via tobit model, and thus spautoreg can resolve the problem of missing values that exist in many kinds of data. Otherwise, in continuous data the usual normal estimation will be used.

spautoreg can fit many spatial regression models.

1- model(ols) Spatial Lag OLS Model

2- model(lag) Spatial Lag Model

3- model(durbin) Spatial Durbin Model

4- model(error) Spatial Error Model

5- model(sac) Spatial Lag / Error Model

6- model(ivtobit) IV Spatial Tobit Model (IVTobit): Truncat > ed depvar ivtobit

7- model(gs2sls) Spatial Generalized 2SLS Model (GS2SLS) ivr > eg2 (if installed)

8- model(gs3sls) Spatial Generalized 3SLS Model (GS3SLS) reg > 3

9- model(spml) MLE -Spatial Lag/Error Autoregressive (MLE-SPREG) spr > eg (if installed)

10- model(spgs) GS2SLS Spatial Lag/Error Autoregressive (GS2SLS-SPREG) spr > eg (if installed)

11- model(spiv) IV Spatial Lag/Error Autoregressive (SPIVREG) spi > vreg (if installed)

12- model(spgls) Spatial Autoregressive Generalized Least Squares Kelejian- > Prucha(1999)

13- model(spgsar) Generalized Spatial Autoregressive 2SLS Model Kelejian- > Prucha(1998)

spautoreg can calculate: - Total Marginal Effects and Elasticities. - Direct Marginal Effects and Elasticities. - InDirect Marginal Effects and Elasticities.

spautoreg can generate: - Binary Weight Matrix. - Binary Eigenvalues Variable.

- Row-Standardized Weight Matrix. - Row-Standardized Eigenvalues Variable.

- Spatial lagged variables up to 4th order.

Predicted values for dependent variable in model(error) can be obtained using predict command after estimation: . predict Yh_Error

spautoreg predicted values in model(lag, durbin, sac) models are obtained from conditional expectation expression.

Yh = E(y|x) = inv(I-Rho*W) * X*Beta

R2, R2 Adjusted, and F-Test, are obtained from two ways: 1- squared correlation between predicted (Yh) and observed dependent variable (Y). 2- Ratio of variance between predicted (Yh) and observed dependent variable (Y). - R2 Adjusted: R2_a=1-(1-R2)*(N-1)/(N-K-1). - F-Test=R2/(1-R2)*(N-K-1)/(K).

Log Likelihood Function (LLF), Akaike Information Criterion (AIC), and Schwarz Criterion (SC) were displayed in: model(lag, error, durbin, sac, gs2sls, gs3sls, spgls, spgsar, ivtobit, spml).

Other maximization_options allows the user to specify other maximization options (e.g., difficult, trace, iterate(#), constraint(#), etc.). However, you should rarely have to specify them, though they may be helpful if parameters approach boundary values.

+---------------+ ----+ Saved Results +----------------------------------------------------

spautoreg saves the following results in e():

Scalars e(archi2) Anderson-Rubin chi-sq test of significance of endogenous r > egressors e(archi2p) p-value of Anderson-Rubin chi-sq test of endogenous regres > sors e(ardf) degrees of freedom of Anderson-Rubin tests of endogenous r > egressors e(ardf_r) denominator degrees of freedom of AR F-test of endogenous > regressors e(arf) Anderson-Rubin F-test of significance of endogenous regres > sors e(arfp) p-value of Anderson-Rubin F-test of endogenous regressors e(arubin) Anderson-Rubin overidentification LR statistic N*ln(lambda > ) e(arubin_lin) Anderson-Rubin linearized overidentification statistic N*( > lambda-1) e(arubin_linp) p-value of Anderson-Rubin linearized overidentification st > atistic e(arubindf) dof of A-R overid statistic = degree of overidentification > = L-K e(arubinp) p-value of Anderson-Rubin overidentification LR statistic e(bw) Bandwidth e(chi2) chi-squared e(chi2_#) chi-squared for equation # e(chi2_exog) Wald chi-squared test of exogeneity e(cstat) C-statistic e(cstatdf) Degrees of freedom of C-statistic e(cstatp) p-value of C-statistic e(df_m) model degrees of freedom e(df_m#) model degrees of freedom for equation # e(df_r) Residual degrees of freedom e(dfk2_adj) divisor used with VCE when dfk2 specified e(endog_ct) number of endogenous regressors e(F) F statistic e(F_#) F statistic for equation # (small) e(fth) F-test due to r2h e(ftv) F-test due to r2v e(fuller) Fuller parameter alpha e(ic) number of iterations e(iddf) dof of underidentification LM statistic e(idp) p-value of underidentification LM statistic e(idstat) LM test for underidentification (Anderson or Kleibergen-Pa > ap) e(j) Hansen J statistic e(jdf) dof of Hansen J statistic = degree of overidentification = > L-K e(jp) p-value of Hansen J statistic e(k) number of parameters e(k_autoCns) number of base, empty, and omitted constraints e(k_aux) number of auxiliary parameters e(k_dv) number of dependent variables e(k_eform) number of leading equations appropriate for eform output e(k_eq) number of equations e(k_eq_model) number of equations in model Wald test e(kclass) k in k-class estimation e(lambda) LIML eigenvalue e(ll) log likelihood e(ll_0) log likelihood for OLS e(llopt) contents of ll() e(maxEig) Maximum eigenvalue e(minEig) Minimum eigenvalue e(mss_#) model sum of squares for equation # e(N) number of observations e(N_clust) number of clusters e(N_lc) number of left-censored observations e(N_rc) number of right-censored observations e(N_unc) number of uncensored observations e(p) significance of model of test e(p) model Wald p-value e(p_#) significance for equation # e(p_exog) exogeneity test Wald p-value e(p_wald) p-value for Wald test e(partial_ct) Number of partialled-out variables (see e(partial)) e(r2) Centered R-squared if the eqn has a constant e(r2_#) R-squared for equation # e(r2_a) Adjusted R-squared e(r2c) Centered R-squared, 1-rss/yyc e(r2h) R2 between predicted and observed depvar e(r2h_a) adjusted r2h e(r2u) Uncentered R-squared, 1-rss/yy e(r2v) R2 variance ratio between predicted and observed depvar e(r2v_a) adjusted r2v e(rank) rank of e(V) e(rank0) rank of e(V) for OLS e(rankS) Rank of covariance matrix S of orthogonality conditions e(rankV) Rank of covariance matrix V of coefficients e(rankxx) Rank of the matrix of observations on rhs variables=K e(rankzz) Rank of the matrix of observations on instruments=L e(rc) return code e(reddf) dof of LM statistic for instrument redundancy e(redp) p-value of LM statistic for instrument redundancy e(redstat) LM statistic for instrument redundancy e(rho_2sls) initial estimate of rho e(rmse_#) root mean squared error for equation # e(rss) Residual SS e(rss_#) residual sum of squares for equation # e(sargan) Sargan statistic e(sargandf) dof of Sargan statistic = degree of overidentification = L > -K e(sarganp) p-value of Sargan statistic e(ulopt) contents of ul() e(wald) Wald test e(WALD) Wald test for rho or lambda equal to zero e(widstat) F statistic for weak identification (Cragg-Donald or Kleib > ergen-Paap) e(yy) Total sum of squares (SS), uncentered (y'y) e(yyc) Total SS, centered (y'y - ((1'y)^2)/n)

Macros e(asobserved) factor variables fvset as asobserved e(chi2type) Wald; type of model chi-squared test e(clist) Instruments tested for orthogonality e(clustvar) name of cluster variable e(cmd) name of the command e(cmdline) command as typed e(collin) Variables dropped because of collinearities e(corr) correlation structure e(crittype) optimization criterion e(depvar) Name of dependent variable e(diparm#) display transformed parameter # e(dlmat) name of spmat object in dlmat() e(dups) Duplicate variables e(elmat) name of spmat object in elmat() e(endog) names of endogenous variables e(eqnames) names of equations e(estat_cmd) program used to implement estat e(estimator) gs2sls e(exexog) Excluded instruments e(exog) names of exogenous variables e(exogr) exogenous regressors e(firsteqs) Names of stored first-stage equations e(footnote) program used to implement the footnote display e(het) heteroskedastic or homoskedastic e(idvar) name of ID variable e(indeps) names of independent variables e(inexog) Included instruments (regressors) e(instd) Instrumented (RHS endogenous) variables e(insts) Instruments e(kernel) Kernel e(marginsnotok) predictions disallowed by margins e(marginsok) predictions allowed by margins e(opt) type of optimization e(partial) Partialled-out exogenous regressors e(predict) program used to implement predict e(properties) estimator properties e(redlist) Instruments tested for redundancy e(rfeq) Name of stored reduced-form equation e(small) small e(technique) maximization technique from technique() option e(title) title in estimation output e(tvar) Time variable e(user) name of likelihood-evaluator program e(vce) vcetype Covariance estimation method specified in vce() e(version) Version number of ivreg2 e(weights) name of spatial weight matrix e(wexp) weight expression e(wtype) weight type

Matrixes e(b) coefficient vector e(V) variance-covariance matrix of the estimators e(mfx) Beta, Total, Direct, and InDirect Marginal Effect e(mfxe) Beta, Total, Direct, and InDirect Elasticity e(Cns) constraints matrix e(delta_2sls) initial estimate of lambda and b e(gradient) gradient vector e(ilog) iteration log (up to 20 iterations) e(ml_h) derivative tolerance, (abs(b)+1e-3)*1e-3 e(ml_scale) derivative scale factor e(Sigma) Sigma hat matrix e(V_modelbased) model-based variance e(ccev) Eigenvalues for Anderson canonical correlations test e(cdev) Eigenvalues for Cragg-Donald test e(first) First-stage regression results e(ilog) iteration log e(S) Covariance matrix of orthogonality conditions e(W) GMM weighting matrix (=inverse of S if efficient GMM estim > ator)

Functions e(sample) marks estimation sample

Scalars

*** Spatial Aautocorrelation Tests: e(mig) GLOBAL Moran MI e(migp) GLOBAL Moran MI P-Value e(gcg) GLOBAL Geary GC e(gcgp) GLOBAL Geary GC P-Value e(gog) GLOBAL Getis-Ords GO e(gogp) GLOBAL Getis-Ords GO P-Value e(mi1) Moran MI Error Test e(mi1p) Moran MI Error Test P-Value e(lmerr) LM Error e(lmerrp) LM Error P-Value e(lmerrr) LM Error (Robust) e(lmerrrp) LM Error (Robust) P-Value e(lmlag) LM Lag e(lmlagp) LM Lag P-Value e(lmlagr) LM Lag (Robust) e(lmlagrp) LM Lag (Robust) P-Value e(lmsac1) LM SAC (LMLag+LMErr_R) e(lmsac1p) LM SAC (LMLag+LMErr_R) P-Value e(lmsac2) LM SAC (LMErr+LMLag_R) e(lmsac2p) LM SAC (LMErr+LMLag_R) P-Value

*** Autocorrelation Tests: e(lmadw) Durbin-Watson Test e(lmadh) Durbin h Test (Lag DepVar) e(lmadhp) Durbin h Test (Lag DepVar) P-Value e(lmadha) Durbin h Test (Lag DepVar) after AR(1) e(lmadhap) Durbin h Test (Lag DepVar) after AR(1) P-Value e(lmahh) Harvey LM Test (Lag DepVar) e(lmahhp) Harvey LM Test (Lag DepVar) P-Value e(lmahha) Harvey LM Test (Lag DepVar) after AR(1) e(lmahhap) Harvey LM Test (Lag DepVar) after AR(1) P-Value e(lmawt) Wald t Test e(lmawtp) Wald t Test P-Value e(lmawc) Wald LM Test e(lmawcp) Wald LM Test P-Value

*** Model Selection Diagnostic Criteria: e(N) number of observations e(r2h) R2 Between Predicted and Observed DepVar e(r2h_a) Adjusted r2h e(r2v) R2 Variance Ratio Between Predicted and Observed DepVar e(r2v_a) Adjusted r2v e(fth) F-test due to r2h e(fthp) F-test due to r2h P-Value e(ftv) F-test due to r2v e(ftvp) F-test due to r2v P-Value e(llf) Log Likelihood Function e(aic) Akaike Final Prediction Error AIC e(sc) Schwartz Criterion SC e(laic) Akaike Information Criterion ln AIC e(lsc) Schwarz Criterion Log SC e(hq) Hannan-Quinn Criterion HQ1 e(gcv) Craven-Wahba Generalized Cross Validation-GCV e(shibata) Shibata Criterion Shibata e(rice) Rice Criterion Rice e(fpe) Amemiya Prediction Criterion FPE e(df1) DF1 e(df2) DF2 e(rmse) Root Mean Squared Error e(rss) Residual Sum of Squares e(maxEig) Maximum Eigenvalue e(minEig) minimum Eigenvalue e(wald) Wald Test e(waldp) Wald Test P-Value

*** Identification Restrictions LM Tests (gs2sls): e(lmb) Basmann LM Test e(lmbp) Basmann LM Test P-Value e(lms) Sargan LM Test e(lmsp) Sargan LM Test P-Value

*** REgression Specification Error Tests (RESET): e(reset2) Ramsey RESET2 Test e(reset2p) Ramsey RESET2 Test P-Value e(reset3) Ramsey RESET3 Test e(reset3p) Ramsey RESET3 Test P-Value e(reset4) Ramsey RESET4 Test e(reset4p) Ramsey RESET4 Test P-Value e(lmw) White Functional Form Test e(lmwp) White Functional Form Test P-Value

*** Heteroscedasticity Tests: e(lmhhp1) Hall-Pagan LM Test E2 = Yh e(lmhhp1p) Hall-Pagan LM Test E2 = Yh P-Value e(lmhhp2) Hall-Pagan LM Test E2 = Yh2 e(lmhhp2p) Hall-Pagan LM Test E2 = Yh2 P-Value e(lmhhp3) Hall-Pagan LM Test E2 = Yh3 e(lmhhp3p) Hall-Pagan LM Test E2 = Yh3 P-Value e(lmhw01) White Test - Koenker(R2) E2 = X e(lmhw01p) White Test - Koenker(R2) E2 = X P-Value e(lmhw02) White Test - B-P-G (SSR) E2 = X e(lmhw02p) White Test - B-P-G (SSR) E2 = X P-Value e(lmhw11) White Test - Koenker(R2) E2 = X X2 e(lmhw11p) White Test - Koenker(R2) E2 = X X2 P-Value e(lmhw12) White Test - B-P-G (SSR) E2 = X X2 e(lmhw12p) White Test - B-P-G (SSR) E2 = X X2 P-Value e(lmhw21) White Test - Koenker(R2) E2 = X X2 XX e(lmhw21p) White Test - Koenker(R2) E2 = X X2 XX P-Value e(lmhw22) White Test - B-P-G (SSR) E2 = X X2 XX e(lmhw22p) White Test - B-P-G (SSR) E2 = X X2 XX P-Value e(lmhharv) Harvey LM Test e(lmhharvp) Harvey LM Test P-Value e(lmhwald) Wald Test e(lmhwaldp) Wald Test P-Value e(lmhgl) Glejser LM Test e(lmhglp) Glejser LM Test P-Value e(lmhcw1) Cook-Weisberg LM Test E = Yh e(lmhcw1p) Cook-Weisberg LM Test E = Y P-Valueh e(lmhcw2) Cook-Weisberg LM Test E = X e(lmhcw2p) Cook-Weisberg LM Test E = X P-Value

*** Non Normality Tests: e(lmnjb) Jarque-Bera LM Test e(lmnjbp) Jarque-Bera LM Test P-Value e(lmnw) White IM Test e(lmnwp) White IM Test P-Value e(lmndh) Doornik-Hansen LM Test e(lmndhp) Doornik-Hansen LM Test P-Value e(lmng) Geary LM Test e(lmngp) Geary LM Test P-Value e(lmnad) Anderson-Darling Z Test e(lmnadp) Anderson-Darling Z Test P-Value e(lmndp) D'Agostino-Pearson LM Test e(lmndpp) D'Agostino-Pearson LM Test P-Value e(lmnsvs) Srivastava LM Skewness Test e(lmnsvsp) Srivastava LM Skewness Test P-Value e(lmnsms1) Small LM Skewness Test e(lmnsms1p) Small LM Skewness Test P-Value e(lmnsms2) Skewness Z Test e(lmnsms2p) Skewness Z Test P-Value e(lmnsvk) Srivastava Z Kurtosis Test e(lmnsvkp) Srivastava Z Kurtosis Test P-Value e(lmnsmk1) Small LM Kurtosis Test e(lmnsmk1p) Small LM Kurtosis Test P-Value e(lmnsmk2) Kurtosis Z Test e(lmnsmk2p) Kurtosis Z Test P-Value e(sk) Skewness Coefficient e(sksd) Skewness Standard Deviation e(ku) Kurtosis Coefficient e(kusd) Kurtosis Standard Deviation e(sn) Standard Deviation Runs Sig(k) e(en) Mean Runs E(k) e(lower) Lower 95% Conf. Interval [E(k)- 1.96* Sig(k)] e(upper) Upper 95% Conf. Interval [E(k)+ 1.96* Sig(k)]

e(lmnpv) Pagan-Vella LM Test (Tobit Model) e(lmnpvp) Pagan-Vella LM Test (Tobit Model) P-Value e(lmnci) Chesher-Irish LM Test (Tobit Model) e(lmncip) Chesher-Irish LM Test (Tobit Model) P-Value

+------------+ ----+ References +-------------------------------------------------------

Anderson T.W., Darling D.A. (1954) "A Test of Goodness of Fit", Journal of the American Statisical Association, 49; 765–69.

Anderson, T. W. & H. Rubin (1950) "The Asymptotic Properties of Estimates of the Parameters of a Single Equation in a Complete System of Stochastic Equations", Annals of Mathematical Statistics, Vol. 21; 570-82.

Anselin, L., Kelejian, H. H. (1997) "Testing for Spatial Error Autocorrelation in the Presence of Endogenous Regressors", International Regional Science Review, (20); 153-182.

Anselin, L. (2001) "Spatial Econometrics", In Baltagi, B. (Ed).: A Companion to Theoretical Econometrics Basil Blackwell: Oxford, UK.

Anselin, L. (2007) "Spatial Econometrics", In T. C. Mills and K. Patterson (Eds).: Palgrave Handbook of Econometrics. Vol 1, Econometric Theory. New York: Palgrave MacMillan.

Basmann, R.L. (1960) {cmd: "On Finite Sample Distributions of Generalized Classical Linear Identifiability Test Statistics",} Journal of the American Statisical Association, 55, Issue 292, DecemberA; 650-59.

Breusch, Trevor & Adrian Pagan (1980) "The Lagrange Multiplier Test and its Applications to Model Specification in Econometrics", Review of Economic Studies 47; 239-253.

C.M. Jarque & A.K. Bera (1987) "A Test for Normality of Observations and Regression Residuals" International Statistical Review , Vol. 55; 163-172.

Cook, R.D., & S. Weisberg (1983) "Diagnostics for Heteroscedasticity in Regression", Biometrica 70; 1-10.

D'Agostino, R. B., & Rosman, B. (1974) "The Power of Geary’s Test of Normality", Biometrika, 61(1); 181-184.

Damodar Gujarati (1995) "Basic Econometrics" 3rd Edition, McGraw Hill, New York, USA.

Drukker, D. M., I. R. Prucha, and R. Raciborski. (2011) "Maximum-likelihood and generalized spatial two-stage least-squares estimators for a spatial-autoregressive model with spatial-autoregressive disturbances", Working paper, University of Maryland, Department of Economics. http://econweb.umd.edu/~prucha/Papers/WP_spreg_2011.pdf.

Drukker, D. M., I. R. Prucha, and R. Raciborski. (2011) "A command for estimating spatial-autoregressive models with spatial autoregressive disturbances and additional endogenous variables", Working paper, The University of Maryland, Department of Economics. http://econweb.umd.edu/~prucha/Papers/WP_spivreg_2011.pdf.

Durbin, James (1970a) "Testing for Serial Correlation in Least-Squares Regression When Some of the Regressors are Lagged Dependent Variables", Econometrica, vol.38, no.3, May; 410-421.

Geary R.C. (1947) "Testing for Normality" Biometrika, Vol. 34; 209-242.

Geary R.C. (1970) "Relative Efficiency of Count of Sign Changes for Assessing Residuals Autoregression in Least Squares Regression" Biometrika, Vol. 57; 123-127.

Godfrey, L. G. (1978) "Testing for Multiplicative Heteroskedasticity", Journal of Econometrics, Vol.8; 227-236.

Greene, William (1993) "Econometric Analysis", 2nd ed., Macmillan Publishing Company Inc., New York, USA..

Greene, William (2007) "Econometric Analysis", 6th ed., Macmillan Publishing Company Inc., New York, USA..

Griffiths, W., R. Carter Hill & George Judge (1993) "Learning and Practicing Econometrics", John Wiley & Sons, Inc., New York, USA.

Harvey, Andrew (1990) "The Econometric Analysis of Time Series", 2nd edition, MIT Press, Cambridge, Massachusetts.

Harry H. Kelejian and Ingmar R. Prucha (1998) "A Generalized Spatial Two-Stage Least Squares Procedures for Estimating a Spatial Autoregressive Model with Autoregressive Disturbances", Journal of Real Estate Finance and Economics, (17); 99-121.

Harry H. Kelejian and Ingmar R. Prucha (1999) "A Generalized Moments Estimator for the Autoregressive Parameter in a Spatial Model, International Economic Review, (40); 509-533.

Hausman, Jerry (1978) "Specification Tests in Econometrics", Econometrica, vol.46, Nov.; 1251-1271.

Hausman, Jerry & Taylor W. (1983) "Identification in Linear Simultaneous Equations Models with Covariance Restrictions: An Instrumental Variables Interpretation", Econometrica, vol.51.; 1527-1549.

Judge, Georege, R. Carter Hill, William . E. Griffiths, Helmut Lutkepohl, & Tsoung-Chao Lee (1988) "Introduction To The Theory And Practice Of Econometrics", 2nd ed., John Wiley & Sons, Inc., New York, USA.

Judge, Georege, W. E. Griffiths, R. Carter Hill, Helmut Lutkepohl, & Tsoung-Chao Lee(1985) "The Theory and Practice of Econometrics", 2nd ed., John Wiley & Sons, Inc., New York, USA.

Kmenta, Jan (1986) "Elements of Econometrics", 2nd ed., Macmillan Publishing Company, Inc., New York, USA; 618-625.

Koenker, R. (1981) "A Note on Studentizing a Test for Heteroskedasticity", Journal of Econometrics, Vol.17; 107-112.

Maddala, G. (1992) "Introduction to Econometrics", 2nd ed., Macmillan Publishing Company, New York, USA.

Pagan, Adrian .R. & Hall, D. (1983) "Diagnostic Tests as Residual Analysis", Econometric Reviews, Vol.2, No.2,. 159-218.

Pearson, E. S., D'Agostino, R. B., & Bowman, K. O. (1977) "Tests for Departure from Normality: Comparison of Powers", Biometrika, 64(2); 231-246.

Ramsey, J. B. (1969) "Tests for Specification Errors in Classical Linear Least-Squares Regression Analysis", Journal of the Royal Statistical Society, Series B 31; 350-371.

Sargan, J.D. (1958) "The Estimation of Economic Relationships Using Instrumental Variables", Econometrica, vol.26; 393-415.

Szroeter, J. (1978) "A Class of Parametric Tests for Heteroscedasticity in Linear Econometric Models", Econometrica, 46; 1311-28.

Theil, Henri (1971) "Principles of Econometrics", John Wiley & Sons, Inc., New York, USA.

White, Halbert (1980) "A Heteroskedasticity-Consistent Covariance Matrix Estimator and a Direct Test for Heteroskedasticity", Econometrica, 48; 817-838.

+----------+ ----+ Examples +---------------------------------------------------------

spweight module can be used to create Cross Section Weight Matrix. If the user already has a squared Cross Section Weight Matrix.

Note: You can use the dialog box for spautoreg, spweight. -------------------------------------------------------------------------------

clear all

sysuse spautoreg.dta, clear

* (1) Spatial Lag Model (SAR):

spautoreg y x1 x2 , wmfile(SPW) wmat(W) eigw(eW) model(lag) alltest

spautoreg y x1 x2 , wmfile(SPW) wmat(W) eigw(eW) model(lag) mfx(lin) spar(rho) > lmsp lma lmn lmh reset

spautoreg ys x1 x2 , wmfile(SPW) wmat(W) eigw(eW) model(lag) mfx(lin) spar(rho) > lmsp lma lmn lmh reset

spautoreg y x1 x2 , wmfile(SPW) wmat(W) eigw(eW) model(lag) predict(Yh_Lag) re > sid(Ue_Lag) -------------------------------------------------------------------------------

* (2) Spatial Error Model (SEM):

spautoreg y x1 x2 , wmfile(SPW) wmat(W) eigw(eW) model(error) mfx(lin) lmsp lma > lmn lmh reset -------------------------------------------------------------------------------

* (3) Spatial Durbin Model (SDM):

spautoreg y x1 x2 , wmfile(SPW) wmat(W) eigw(eW) model(durbin) mfx(lin) spar(rh > o) lmsp lma lmn lmh reset -------------------------------------------------------------------------------

* (4) Spatial AutoCorrelation Model (SAC):

spautoreg y x1 x2 , wmfile(SPW) wmat(W) eigw(eW) model(sac) mfx(lin) spar(rho) > lmsp

spautoreg y x1 x2 , wmfile(SPW) wmat(W) eigw(eW) model(sac) mfx(lin) spar(lam) > lmsp

spautoreg y x1 x2 , wmfile(SPW) wmat(W) eigw(eW) model(spml) mfx(lin) spar(rho) > lmsp

spautoreg y x1 x2 , wmfile(SPW) wmat(W) eigw(eW) model(spgs) mfx(lin) spar(lam) > lmsp

spautoreg y x1 x2 , wmfile(SPW) wmat(W) eigw(eW) model(spiv) mfx(lin) spar(rho) > lmsp -------------------------------------------------------------------------------

* (5) Spatial GS2SLS - AR(1)

spautoreg y x1 x2 , wmfile(SPW) wmat(W) eigw(eW) model(gs2sls) order(1) wxlag(1 > ) lmsp lmiden

* (6) Spatial GS3SLS - AR(1)

spautoreg y x1 x2 , wmfile(SPW) wmat(W) eigw(eW) model(gs3sls) order(1) wxlag(1 > ) lmsp -------------------------------------------------------------------------------

* (7) Spatial IV Tobit

spautoreg y x1 x2 , wmfile(SPW) wmat(W) eigw(eW) model(ivtobit) order(1) wxlag( > 1) mfx(lin) -------------------------------------------------------------------------------

* (8) Spatial Multiplicative Heteroscedasticity

spautoreg y x1 x2 , wmfile(SPW) wmat(W) eigw(eW) model(lag) spar(rho) mhet(x1 x > 2) mfx(lin) lmsp

spautoreg y x1 x2 , wmfile(SPW) wmat(W) eigw(eW) model(durbin) spar(rho) mhet(x > 1 x2) mfx(lin) -------------------------------------------------------------------------------

* (9) Spatial Autoregressive Feasible Generalized Least Squares

spautoreg y x1 x2 , wmfile(SPW) wmat(W) eigw(eW) model(spgls) mfx(lin) lmsp -------------------------------------------------------------------------------

* (10) Generalized Spatial Autoregressive 2SLS Model

spautoreg y x1 x2 , wmfile(SPW) wmat(W) eigw(eW) model(spgsar) mfx(lin) lmsp -------------------------------------------------------------------------------

* (11) Spatial Exponential Regression Model

spautoreg y x1 x2 , wmfile(SPW) wmat(W) eigw(eW) model(lag) dist(exp) spautoreg y x1 x2 , wmfile(SPW) wmat(W) eigw(eW) model(error) dist(exp) spautoreg y x1 x2 , wmfile(SPW) wmat(W) eigw(eW) model(durbin) dist(exp) spautoreg y x1 x2 , wmfile(SPW) wmat(W) eigw(eW) model(sac) dist(exp) -------------------------------------------------------------------------------

* (12) Spatial Weibull Regression Model

spautoreg y x1 x2 , wmfile(SPW) wmat(W) eigw(eW) model(lag) dist(weib) spautoreg y x1 x2 , wmfile(SPW) wmat(W) eigw(eW) model(error) dist(weib) spautoreg y x1 x2 , wmfile(SPW) wmat(W) eigw(eW) model(durbin) dist(weib) spautoreg y x1 x2 , wmfile(SPW) wmat(W) eigw(eW) model(sac) dist(weib) -------------------------------------------------------------------------------

+-----------------+ ----+ Acknowledgments +--------------------------------------------------

I would like to thank the authors of the following Stata modules:

- David Drukker, and Ingmar Prucha for writing sppack.

- Christopher F Baum, Mark E Schaffer, and Steven Stillman for stata module > ivreg2.

- Maurizio Pisati for stata module spatreg.

- Wilner Jeanty for stata module spmlreg.

+--------+ ----+ Author +-----------------------------------------------------------

Emad Abd Elmessih Shehata Assistant Professor Agricultural Research Center - Agricultural Economics Research Institute - Eg > ypt Email: emadstat@hotmail.com WebPage: http://emadstat.110mb.com/stata.htm WebPage at IDEAS: http://ideas.repec.org/f/psh494.html WebPage at EconPapers: http://econpapers.repec.org/RAS/psh494.htm

+--------------------+ ----+ spautoreg Citation +-----------------------------------------------

Shehata, Emad Abd Elmessih (2011) SPAUTOREG: "Stata Module to Estimate Spatial Regression Models: (Lag-Error-Durbin-SAC-SPGLS-SPGSAR-GS2SLS-GS3SLS-SPML-SPGS-SPIVREG-IVTobi > t)"

http://econpapers.repec.org/software/bocbocode/s457338.htm

http://ideas.repec.org/c/boc/bocode/s457338.html

Online Help:

gs3sls, gs2slsxt, spxttobit, spregxt, spglsxt, spautoreg, spmstar, spmstarxt, spweight, spweightxt, spweightcs, spcs2xt, xtidt. (if installed).