-------------------------------------------------------------------------------
help: spautoreg                                                   dialog: spaut
> oreg
-------------------------------------------------------------------------------

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

spautoreg: Spatial Cross Sections Regression Models: (SAR - SEM - SDM - SAC - SARARGS - SARARIV - SARARML - SPGMM GS2SLS - GS2SLSAR - GS3SLS - GS3SLSAR - IVTOBIT)

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

Syntax Description Model Options Options Spatial Aautocorrelation Tests Model Selection Diagnostic Criteria Heteroscedasticity Tests Non Normality Tests Hausman Specification Test OLS/IV-2SLS Tests Identification Restrictions LM Tests REgression Specification Error Tests (RESET) Saved Results References

*** Examples

Acknowledgments Author

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

spautoreg depvar indepvars [weight] , wmfile(weight_file) model(sar|sem|sdm|sac|sararml|sarargs|sarariv|spgmm|gs2sls|gs2slsar|gs > 3sls|gs3slsar) [lmspac lmauto lmhet lmnorm lmcl lmiden hausman reset diag tests stand inv inv2 dist(norm|exp|weib) mfx(lin, log) spar(rho, lam) aux(varlist) mhet(varlist) order(#) inrho(real 0) inlambda(real 0) var2(varlist) eq(1, 2) predict(new_var) resid(new_var) iter(#) tech(name) coll zero ols 2sls 3sls sure mvreg tobit ll(real 0) noconstant het tolog nolog robust twostep grids(#) impower(#) level(#) vce(vcetype) maximize other maximization options ]

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

spautoreg estimates Spatial Cross Sections Regression Models estimation Many types of spatial autocorrelations were taken under consedration, i.e., (SAR - SEM - SDM - SAC - GS2SLS - GS2SLSAR - GS3SLS - GS3SLSAR - IVTOBIT - SARARGS - SARARIV - SARARML - SPGMM)

spautoreg can estimate the following models: 1- Heteroscedastic Regression Models in disturbance term. 2- Non Normal Regression Models in disturbance term.

spautoreg estimates Continuous and Truncated Dependent Variables models tobit.

model(sar, sem, sdm, sac, spgmm) deals with data either continuous or truncated dependent variable. If depvar has missing values or lower limits, so in this case model(sar, sem, sdm, sac, spgmm) will fit spatial cross section model via tobit model, and thus spautoreg can resolve the problem of missing values that exist in many kinds of data. Otherwise, in the case of continuous data, the normal estimation will be used.

spautoreg can generate: - Binary / Standardized Weight Matrix. - Inverse / Inverse Squared Standardized Weight Matrix. - Binary / Standardized / Inverse Eigenvalues Variable. - Spatial lagged variables up to 4th order.

spautoreg predicted values in model(sar, sdm, 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 4 ways: 1- (Buse 1973) R2. 2- Raw Moments R2. 3- squared correlation between predicted (Yh) and observed dependent variable (Y). 4- Ratio of variance between predicted (Yh) and observed dependent variable (Y).

- Adjusted R2: R2_a=1-(1-R2)*(N-1)/(N-K-1). - F-Test=R2/(1-R2)*(N-K-1)/(K).

Buse(1973) R2 in model(gs2sls, gs2slsar) may be negative, to avoid negative R2, you can increase number on instrumental variables by choosing order more than 1 order(2, 3, 4)

*** Important Notes: spautoreg generates some variables names with prefix: w1x_ , w2x_ , w3x_ , w4x_ , w1y_ , w2y_ , mstar_ , spat_ So, you must avoid to include variables names with thes prefixes

+---------------+ ----+ Model Options +----------------------------------------------------

1- model(sar) MLE Spatial Lag Model (SAR)

2- model(sdm) MLE Spatial Durbin Model (SDM)

3- model(sem) MLE Spatial Error Model (SEM)

4- model(sac) MLE Spatial Lag / Error Model (SAC) "Spatial AutoCorrelatio > n"

5- model(spgmm) Spatial Autoregressive Generalized Method of Moments Model When cross section data model with error are both spatially correlated. Generalized Method of Moments (GMM) that suggested in Kelejian-Prucha (1999) is used in the estimation of model(spgmm)

6- model(spgmm) Tobit Spatial Autoregressive GMM with option(tobit)

7- model(gs2sls) Generalized Spatial 2SLS

8- model(gs2slsar) Generalized Spatial Autoregressive 2SLS [Kelejian-Prucha(19 > 98)] Since no softwares available till now to estimate generalized spatial cross section autoregressive 2SLS models, I designed gs2slsar as a modification of Kapoor-Kelejian-Prucha (1999), but here I let the estimations deal with cross section 2SLS models, with original constant term.

9- model(gs3sls) Generalized Spatial 3SLS Model

10- model(gs3slsar) Generalized Spatial Autoregressive 3SLS Model [Kelejian-Pru > cha(2004)]

11- model(ivtobit) MLE - IV Spatial Tobit Model Truncated depvar ivtobit

12- model(sararml) MLE - Spatial Lag/Autoregressive Error (spreg)

13- model(sarargs) Generalized Spatial Lag/Autoregressive Error GS2SLS (spreg)

14- model(sarariv) Generalized Spatial Lag/Autoregressive Error IV-GS2SLS (spiv > reg)

model(sararml|sarargs|sarariv) Requires - Stata v11.2 - (sppack) module ssc install sppack - Binary Weight Matrix must be used.

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

wmfile(weight_file) Open CROSS SECTION weight matrix file.

Spatial Cross Sections Weight Matrix file should be: 1- Square Matrix [NxN] 2- Symmetric Matrix (Optional)

Spatial Weight Matrix has two types: Standardized and binary weight matrix.

stand Use Standardized Weight Matrix, (each row sum equals 1) Default is Binary spatial Weight Matrix which each element i > s 0 or 1

inv Use Inverse Standardized Weight Matrix (1/W)

inv2 Use Inverse Squared Standardized Weight Matrix (1/W^2)

zero convert missing values observations to Zero

order(1, 2, 3, 4) Order of lagged independent variables up to maximum 4th ord > er. order(2,3,4) works only with: model(gs2sls, gs2slsar). Default is > 1

eq(1, 2) Tests for equation (#) in model(gs3sls, gs3slsar), default is 1.

var2(varlist) Dependent-Independent Variables for the second equation in model(gs3sls, gs3slsar).

var2(varlist) must be combine with: model(gs3sls) if you have system of 2 Equations: Y1 = Y2 X1 X2 Y2 = Y1 X3 X4 Variables of Eq. 1 will be Dep. & Indep. Variables Variables of Eq. 2 will be Dep. & Indep. Variables in option var2( ); i > .e, spautoreg y1 x1 x2 , wmfile(SPWcs) model(gs3sls) var2(y2 x3 x4) eq(1) spautoreg y1 x1 x2 , wmfile(SPWcs) model(gs3sls) var2(y2 x3 x4) eq(2)

coll keep collinear variables; default is removing collinear vari > ables.

noconstant Exclude Constant Term from RHS Equation not valid in model(sem, sac)

hausman Hausman Specification Tests

tests display ALL lma, lmh, lmn, lmsp, lmi, diag, reset, haus test > s

dn Use (N) divisor instead of (N-K) for Degrees of Freedom (DF)

ols model(gs3sls) Ordinary Least Squares (OLS) 2sls model(gs3sls) Two-Stage Least Squares (2SLS) 3sls model(gs3sls) Three-Stage Least Squares (3SLS) sure model(gs3sls) Seemingly Unrelated Regression Estimation (SUR > E) mvreg model(gs3sls) SURE with OLS DF adjustment (MVREG)

grids(#) model(sararml)initial grid search values of lambda and rho p > arameters

het model(sarargs, sarariv) Use estimator for heteroskedastic di > sturbance terms

impower(#) model(sarargs, sarariv) Use q powers of matrix W to form instrument matrix H (q= 2,3 > ,...,7). Default is 2

twostep two-step estimate model(ivtobit)

inrho(#) Set initial value for rho; default is 0

inlambda(#) Set initial value for lambda; default is 0

nolog suppress iteration of the log likelihood

tobit Estimate model via Tobit regression

ll(#) value of minimum left-censoring dependent variable with: model(sar, sem, sdm, sac, spgmm, ivtobit), and tobit; defaul > t is 0

mfx(lin, log) functional form: 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 coefficients (Bm), and elasticities are (Es = Bm X/Y). - In Log-Log model: elasticities are the coefficients (Es), and the marginal effects are (Bm = Es Y/X). - mfx(log) and tolog options must be combined, to transform linear variables > to log form.

mfx(lin, log) with model(sar, sdm, sac) can calculate: - Total Marginal Effects and Elasticities. - Direct Marginal Effects and Elasticities. - InDirect Marginal Effects and Elasticities.

tolog Convert dependent and independent variables to LOG Form in the memory for Log-Log regression. tolog Transforms depvar and indepvars to Log Form without lost the original data variables

spar(rho, lam) type of spatial autoregressive coefficients: (rho) [Rho] and (lam) [Lambda] - spar(rho) is default for model(sar, sac, sdm, sararml, sarargs, sarari > v) - spar(rho) cannot be used with model(sem)

- spar(lam) is default for model(sem) - spar(lam) cannot be used with model(sar, sdm) - spar(lam) is an alternative with model(sac) - model(sac, sararml, sarargs, sarariv) work with the two types spar(rho > , lam) - model(gs2sls, gs2slsar, gs3sls, gs3slsar, ivtobit) not work with the two types spar(rho, lam)

dist(norm, exp, weib) Distribution of error term: 1- dist(norm) Normal distribution; default. 2- dist(exp) Exponential distribution. 3- dist(weib) Weibull distribution.

dist option is used to remedy non normality problem, when the error term has non normality distribution. dist(norm, exp, weib) with model(sar, sem, sdm, sac).

dist(norm) is the default distribution.

aux(varlist) add Auxiliary Variables into regression model without converting them to spatial lagged variables, or without log form, i.e., dummy variables. This option dont include these auxiliary variables among spatial lagged variables, it is useful to avoid lost degrees of freedom (DF). Using many dummy variables must be used with caution to avoid multicollinearity problem. aux( ) not works with model(sem, sac).

mhet(varlist) Set variable(s) that will be included in Spatial cross section Multiplicative Heteroscedasticity model, this option is used with model(sar, sdm), to remidy Heteroscedasticity. option [weight], can be used in the case of Heteroscedasticity in errors.

predict(new_variable) Predicted values variable

resid(new_variable) Residuals values variable computed as Ue=Y-Yh

robust Huber-White standard errors model(sar, sdm, spgmm)

tech(name) technique algorithm for maximization of the log likelihood f > unction LLF tech(nr) Newton-Raphson (NR) algorithm; default tech(bhhh) Berndt-Hall-Hall-Hausman (BHHH) algorithm tech(dfp) Davidon-Fletcher-Powell (DFP) algorithm tech(bfgs) Broyden-Fletcher-Goldfarb-Shanno (BFGS) algorithm

iter(#) maximum iterations; default is 100 if iter(#) is reached (100), this means convergence not ach > ieved yet, so you can use another technique algorithm to converge LLF > function or exceed number of maximum iterations more than 100.

vce(vcetype) ols, robust, cluster, bootstrap, jackknife, hc2, hc3

level(#) confidence intervals level; default is level(95)

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

+--------------------------------+ ----+ Spatial Aautocorrelation Tests +-----------------------------------

lmspac Spatial Aautocorrelation Tests: * Ho: Error has No Spatial AutoCorrelation Ha: Error has Spatial AutoCorrelation - GLOBAL Moran MI Test - GLOBAL Geary GC Test - GLOBAL Getis-Ords GO Test - Moran MI Error Test - LM Error [SEM] (Burridge) Test - LM Error [SEM] (Robust) Test * Ho: Spatial Lagged Dependent Variable has No Spatial AutoCorrelation Ha: Spatial Lagged Dependent Variable has Spatial AutoCorrelation - LM Lag [SAR] (Anselin) Test - LM Lag [SAR] (Robust) Test * Ho: No General Spatial AutoCorrelation Ha: General Spatial AutoCorrelation - LM SAC (LMErr+LMLag_R) Test - LM SAC (LMLag+LMErr_R) Test

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

- 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 the spatial dependence due to the omitted variables or errors in measurement through the error term

- Spatial Autoregressive Model (SAR) is also known as Spatial Lag Model

- 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 is spatial error model, [Anselin-Florax (1995)]. - 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

+-------------------------------------+ ----+ Model Selection Diagnostic Criteria +------------------------------

diag Model Selection Diagnostic Criteria: - Log Likelihood Function LLF - Akaike Information Criterion (1974) AIC - Akaike Information Criterion (1973) Log AIC - Schwarz Criterion (1978) SC - Schwarz Criterion (1978) Log SC - Amemiya Prediction Criterion (1969) FPE - Hannan-Quinn Criterion (1979) HQ - Rice Criterion (1984) Rice - Shibata Criterion (1981) Shibata - Craven-Wahba Generalized Cross Validation (1979) GCV

+--------------------------+ ----+ Heteroscedasticity Tests +-----------------------------------------

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 - Machado-Santos-Silva LM Test: Ev= Yh Yh2 - Machado-Santos-Silva LM Test: Ev= 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

*** cross section Tobit Model Heteroscedasticity LM Tests - Separate LM Tests - Ho: Homoscedasticity - Joint LM Test - Ho: Homoscedasticity

+---------------------+ ----+ Non Normality Tests +----------------------------------------------

lmnorm Non Normality Tests: * Ho: Normality - Ha: Non Normality *** Non 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 cross section 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

+---------------------------------------------------+ ----+ Hausman Specification Test (InConsistent Problem) +----------------

hausman Hausman Specification Test (InConsistent Problem) - Ho = B Consistent * Ha = B InConsistent LM = (Bi-Bo)'inv(Vi-Vo)*(Bi-Bo)

+--------------------------------------+ ----+ Identification Restrictions LM Tests +-----------------------------

lmiden Identification Restrictions LM Tests: - Y = LHS Dependent Variable in Equation i - Yi = RHS Endogenous Variables in Equation i - Xi = RHS Included Exogenous Variables in Equation i - Z = Overall Exogenous Variables in the System - Sargan LM Test - Basmann LM Test - Hansen Over Identification LM Test

+----------------------------------------------+ ----+ REgression Specification Error Tests (RESET) +---------------------

reset REgression Specification Error Tests (RESET) * Ho: Model is Specified - Ha: Model is Misspecified - Ramsey RESET2 Test: Y= X Yh2 - Ramsey RESET3 Test: Y= X Yh2 Yh3 - Ramsey RESET4 Test: Y= X Yh2 Yh3 Yh4 - DeBenedictis-Giles Specification ResetL Test - DeBenedictis-Giles Specification ResetS Test - White Functional Form Test: E2= X X2

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

spautoreg saves the following results in e():

Scalars

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

*** Model Selection Diagnostic Criteria: e(N) number of observations e(r2bu) R-squared (Buse 1973) e(r2bu_a) R-squared Adj (Buse 1973) e(r2raw) Raw Moments R2 e(r2raw_a) Raw Moments R2 Adj e(f) F-test e(fp) F-test P-Value e(wald) Wald-test e(waldp) Wald-test P-Value e(r2h) R2 Between Predicted (Yh) and Observed DepVar (Y) e(r2h_a) Adjusted r2h e(fh) F-test due to r2h e(fhp) F-test due to r2h P-Value e(r2v) R2 Variance Ratio Between Predicted (Yh) and Observed DepVar > (Y) e(r2v_a) Adjusted r2v e(fv) F-test due to r2v e(fvp) F-test due to r2v P-Value e(sig) Root MSE (Sigma)

e(llf) Log Likelihood Function LLF e(aic) Akaike Information Criterion (1974) AIC e(laic) Akaike Information Criterion (1973) Log AIC e(sc) Schwarz Criterion (1978) SC e(lsc) Schwarz Criterion (1978) Log SC e(fpe) Amemiya Prediction Criterion (1969) FPE e(hq) Hannan-Quinn Criterion (1979) HQ e(rice) Rice Criterion (1984) Rice e(shibata) Shibata Criterion (1981) Shibata e(gcv) Craven-Wahba Generalized Cross Validation (1979) GCV

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(rank) rank of e(V) e(rmse_#) root mean squared error for equation # e(rss_#) residual sum of squares for equation #

*** 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(lmhmss1) Machado-Santos-Silva LM Test: Ev=Yh Yh2 e(lmhmss1p) Machado-Santos-Silva LM Test: Ev=Yh Yh2 P-Value e(lmhmss2) Machado-Santos-Silva LM Test: Ev=X e(lmhmss2p) Machado-Santos-Silva LM Test: Ev=X 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

*** Hausman Specification cross section/IV-cross section Tests: e(lmhs) Hausman cross section vs IV-cross section e(lmhsp) Hausman cross section vs IV-cross section P-Value

*** Identification Restrictions LM Tests (gs2sls, gs2slsar, gs3sls, gs3slsar, s > arariv, ivtobit): 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(resetf1) Ramsey Specification ResetF1 Test e(resetf1p) Ramsey Specification ResetF1 Test P-Value e(resetf2) Ramsey Specification ResetF2 Test e(resetf2p) Ramsey Specification ResetF2 Test P-Value e(resetf3) Ramsey Specification ResetF3 Test e(resetf3p) Ramsey Specification ResetF3 Test P-Value

e(resetl1) DeBenedictis-Giles Specification ResetL1 Test e(resetl1p) DeBenedictis-Giles Specification ResetL1 Test P-Value e(resetl2) DeBenedictis-Giles Specification ResetL2 Test e(resetl2p) DeBenedictis-Giles Specification ResetL2 Test P-Value e(resetl3) DeBenedictis-Giles Specification ResetL3 Test e(resetl3p) DeBenedictis-Giles Specification ResetL3 Test P-Value

e(resets1) DeBenedictis-Giles Specification ResetS1 Test e(resets1p) DeBenedictis-Giles Specification ResetS1 Test P-Value e(resets2) DeBenedictis-Giles Specification ResetS2 Test e(resets2p) DeBenedictis-Giles Specification ResetS2 Test P-Value e(resets3) DeBenedictis-Giles Specification ResetS3 Test e(resets3p) DeBenedictis-Giles Specification ResetS3 Test P-Value

e(lmw) Functional Form White LM Test e(lmwp) Functional Form White LM Test P-Value

Macros e(cmd) name of the command e(cmdline) command as typed e(depvar) Name of dependent variable e(predict) program used to implement predict e(wmat) name of spatial weight matrix e(dlmat) name of spmat object in dlmat() e(elmat) name of spmat object in elmat() e(endog) names of endogenous variables e(eqnames) names of equations e(het) heteroskedastic or homoskedastic e(technique) maximization technique from technique() option e(title) title in estimation output

Matrixes e(b) coefficient vector e(V) variance-covariance matrix of the estimators

e(mfxlinb) Beta, Total, Direct, and InDirect Marginal Effect for model(sar, sdm, sac, sararml, sarargs, sarariv) in Lin > Form e(mfxline) Beta, Total, Direct, and InDirect Elasticity for model(sar, sdm, sac, sararml, sarargs, sarariv) in Lin > Form

e(mfxlogb) Beta, Total, Direct, and InDirect Marginal Effect for model(sar, sdm, sac, sararml, sarargs, sarariv) in Log > Form e(mfxloge) Beta, Total, Direct, and InDirect Elasticity for model(sar, sdm, sac, sararml, sarargs, sarariv) in Log > Form

e(mfxlin) Marginal Effect and Elasticity in Lin Form e(mfxlog) Marginal Effect and Elasticity in Log Form

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

Functions e(sample) marks estimation sample

+------------+ ----+ 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. (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.

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. & Florax RJ. (1995) "New Directions in Spatial Econometrics: Introduction. In New Directions in Spatial Econometrics", Anselin L, Florax RJ (eds). Berlin, Germany: Springer-Verlag.

Basmann, R.L. (1960) "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.

Brundson,C. A. S. Fotheringham, & M. Charlton (1996) "Geographically Weighted Regression: A Method for Exploring Spatial Nonstationarity" Geographical Analysis,V ol. 28; 281-298.

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.

Elhorst, J. Paul (2003) "Specification and Estimation of Spatial Panel Data Models" International Regional Science review 26, 3; 244–268.

Elhorst, J. Paul (2009) "Spatial Panel Data Models" in Mandfred M. Fischer and Arthur Getis, eds., Handbook of Applied Spatial Analysis, Berlin: Springer.

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 (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.

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. http://econweb.umd.edu/~prucha/Papers/JREFE17(1998).pdf

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. http://econweb.umd.edu/~prucha/Papers/IER40(1999).pdf

Harry H. Kelejian and Ingmar R. Prucha (2004) "Estimation of Simultaneous Systems of Spatially Interrelated Cross Sectional Equations", Journal of Econometrics, (118); 27-50. http://econweb.umd.edu/~prucha/Papers/JE118(2004).pdf

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

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.

James LeSage and R. Kelly Pace (2009) "Introduction to Spatial Econometrics", Publisher: Chapman & Hall/CRC.

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.

Ljung, G. & George Box (1979) "On a Measure of Lack of Fit in Time Series Models", Biometrika, Vol. 66; 265–270.

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.

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

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

Note 1: you can use: spweight, spweightcs, spweightxt to create Spatial Weight > Matrix. Note 2: Remember, your spatial weight matrix should be: *** 1-Cross Section Dimention 2- Square Matrix 3- Symmetric Matrix Note 3: You can use the dialog box for spautoreg. -------------------------------------------------------------------------------

clear all

sysuse spautoreg.dta, clear

* (1) MLE Spatial Lag Model (SAR): spautoreg y x1 x2 , wmfile(SPWcs) model(sar) mfx(lin) test spautoreg y x1 x2 , wmfile(SPWcs) model(sar) mfx(lin) test spautoreg y x1 x2 , wmfile(SPWcs) model(sar) mfx(log) test tolog spautoreg y x1 x2 , wmfile(SPWcs) model(sar) predict(Yh) resid(Ue) spautoreg ys x1 x2, wmfile(SPWcs) model(sar) lmn lmh tobit ll(0) spautoreg ys x1 x2, wmfile(SPWcs) model(sar) lmn lmh tobit ll(3) -------------------------------------------------------------------------------

* (2) MLE Spatial Error Model (SEM): spautoreg y x1 x2 , wmfile(SPWcs) model(sem) mfx(lin) test spautoreg y x1 x2 , wmfile(SPWcs) model(sem) mfx(log) test tolog spautoreg ys x1 x2, wmfile(SPWcs) model(sem) lmn lmh tobit ll(0) -------------------------------------------------------------------------------

* (3) MLE Spatial Durbin Model (SDM): spautoreg y x1 x2 , wmfile(SPWcs) model(sdm) mfx(lin) test spautoreg ys x1 x2, wmfile(SPWcs) model(sdm) lmn lmh tobit ll(0) spautoreg y x1 , wmfile(SPWcs) model(sdm) mfx(lin) test aux(x2) spautoreg y x1 x2 , wmfile(SPWcs) model(sdm) mfx(log) test tolog -------------------------------------------------------------------------------

* (4) MLE Spatial AutoCorrelation Model (SAC): spautoreg y x1 x2 , wmfile(SPWcs) model(sac) mfx(lin) test spar(rho) spautoreg y x1 x2 , wmfile(SPWcs) model(sac) mfx(log) test spar(rho) tolog spautoreg y x1 x2 , wmfile(SPWcs) model(sac) mfx(lin) test spar(lam) spautoreg y x1 x2 , wmfile(SPWcs) model(sac) mfx(log) test spar(lam) tolog spautoreg ys x1 x2, wmfile(SPWcs) model(sac) lmn lmh tobit ll(0) -------------------------------------------------------------------------------

* (5) Spatial Exponential Regression Model: spautoreg y x1 x2 , wmfile(SPWcs) model(sar) dist(exp) mfx(lin) test spautoreg y x1 x2 , wmfile(SPWcs) model(sem) dist(exp) mfx(lin) test spautoreg y x1 x2 , wmfile(SPWcs) model(sdm) dist(exp) mfx(lin) test spautoreg y x1 x2 , wmfile(SPWcs) model(sac) dist(exp) mfx(lin) test -------------------------------------------------------------------------------

* (6) Spatial Weibull Regression Model: spautoreg y x1 x2 , wmfile(SPWcs) model(sar) dist(weib) mfx(lin) test spautoreg y x1 x2 , wmfile(SPWcs) model(sem) dist(weib) mfx(lin) test spautoreg y x1 x2 , wmfile(SPWcs) model(sdm) dist(weib) mfx(lin) test spautoreg y x1 x2 , wmfile(SPWcs) model(sac) dist(weib) mfx(lin) test -------------------------------------------------------------------------------

* (7) Weighted MLE Spatial Models:

* (7-1) Weighted MLE Spatial Lag Model (SAR): spautoreg y x1 x2 [weight = x1], wmfile(SPWcs) model(sar) mfx(lin) test

* (7-2) Weighted MLE Spatial Error Model (SEM): spautoreg y x1 x2 [weight = x1], wmfile(SPWcs) model(sem) mfx(lin) test

* (7-3) Weighted MLE Spatial Durbin Model (SDM): spautoreg y x1 x2 [weight = x1], wmfile(SPWcs) model(sdm) mfx(lin) test

* (7-4) Weighted MLE Spatial AutoCorrelation Model (SAC): spautoreg y x1 x2 [weight = x1], wmfile(SPWcs) model(sac) mfx(lin) test -------------------------------------------------------------------------------

* (8) Spatial Tobit - Truncated Dependent Variable (ys): spautoreg ys x1 x2 , wmfile(SPWcs) model(sar) mfx(lin) test tobit ll(0) spautoreg ys x1 x2 , wmfile(SPWcs) model(sem) mfx(lin) test tobit ll(0) spautoreg ys x1 x2 , wmfile(SPWcs) model(sdm) mfx(lin) test tobit ll(0) spautoreg ys x1 x2 , wmfile(SPWcs) model(sac) mfx(lin) test tobit ll(0) -------------------------------------------------------------------------------

* (9) Spatial Multiplicative Heteroscedasticity: spautoreg y x1 x2 , wmfile(SPWcs) model(sar) mhet(x1 x2) mfx(lin) test spautoreg y x1 x2 , wmfile(SPWcs) model(sdm) mhet(x1 x2) mfx(lin) test -------------------------------------------------------------------------------

* (10) Spatial IV Tobit (IVTOBIT): spautoreg y x1 x2 , wmfile(SPWcs) model(ivtobit) order(1) mfx(lin) test tobit l > l(0) spautoreg y x1 x2 , wmfile(SPWcs) model(ivtobit) order(2) mfx(lin) test tobit l > l(0) spautoreg y x1 x2 , wmfile(SPWcs) model(ivtobit) order(3) mfx(lin) test tobit l > l(0) spautoreg y x1 x2 , wmfile(SPWcs) model(ivtobit) order(4) mfx(lin) test tobit l > l(0) -------------------------------------------------------------------------------

* (11) MLE -Spatial Lag/Autoregressive Error (SARARML): spautoreg y x1 x2 , wmfile(SPWcs) model(sararml) spar(rho) mfx(lin) test spautoreg y x1 x2 , wmfile(SPWcs) model(sararml) spar(lam) mfx(lin) test -------------------------------------------------------------------------------

* (12) Generalized Spatial Lag/Autoregressive Error GS2SLS (SARARGS): spautoreg y x1 x2 , wmfile(SPWcs) model(sarargs) spar(rho) mfx(lin) test spautoreg y x1 x2 , wmfile(SPWcs) model(sarargs) spar(lam) mfx(lin) test -------------------------------------------------------------------------------

* (13) Generalized Spatial Lag/Autoregressive Error IV-GS2SLS (SARARIV): spautoreg y x1 x2 , wmfile(SPWcs) model(sarariv) spar(rho) mfx(lin) test spautoreg y x1 x2 , wmfile(SPWcs) model(sarariv) spar(lam) mfx(lin) test -------------------------------------------------------------------------------

* (14) Spatial Autoregressive Generalized Method of Moments (SPGMM): spautoreg y x1 x2 , wmfile(SPWcs) model(spgmm) mfx(lin) test -------------------------------------------------------------------------------

* (15) Tobit Spatial Autoregressive Generalized Method of Moments (SPGMM): spautoreg ys x1 x2 , wmfile(SPWcs) model(spgmm) mfx(lin) test tobit ll(0) -------------------------------------------------------------------------------

* (16) Generalized Spatial 2SLS Models: * (16-1) Generalized Spatial 2SLS - AR(1) (GS2SLS): spautoreg y x1 x2 , wmfile(SPWcs) model(gs2sls) mfx(lin) test

* (16-2) Generalized Spatial 2SLS - AR(2) (GS2SLS): spautoreg y x1 x2 , wmfile(SPWcs) model(gs2sls) order(2) mfx(lin) test

* (16-3) Generalized Spatial 2SLS - AR(3) (GS2SLS): spautoreg y x1 x2 , wmfile(SPWcs) model(gs2sls) order(3) mfx(lin) test

* (16-4) Generalized Spatial 2SLS - AR(4) (GS2SLS): spautoreg y x1 x2 , wmfile(SPWcs) model(gs2sls) order(4) mfx(lin) test -------------------------------------------------------------------------------

* (17) Generalized Spatial Autoregressive 2SLS (GS2SLSAR): * (17-1) Generalized Spatial Autoregressive 2SLS - AR(1) (GS2SLSAR): spautoreg y x1 x2 , wmfile(SPWcs) model(gs2slsar) order(1) lmi haus

* (17-2) Generalized Spatial Autoregressive 2SLS - AR(2) (GS2SLSAR): spautoreg y x1 x2 , wmfile(SPWcs) model(gs2slsar) order(2) mfx(lin) test

* (17-3) Generalized Spatial Autoregressive 2SLS - AR(3) (GS2SLSAR): spautoreg y x1 x2 , wmfile(SPWcs) model(gs2slsar) order(3) mfx(lin) test

* (17-4) Generalized Spatial Autoregressive 2SLS - AR(4) (GS2SLSAR): spautoreg y x1 x2 , wmfile(SPWcs) model(gs2slsar) order(4) mfx(lin) test -------------------------------------------------------------------------------

* (18) Generalized Spatial 3SLS - (G32SLS) * Y1 = Y2 X1 X2 * Y2 = Y1 X3 X4

* (18-1) Generalized Spatial 3SLS - AR(1) (GS3SLS): spautoreg ys x1 x2 , var2(y2 x3 x4) wmfile(SPWcs) model(gs3sls) eq(1) lmn lmh spautoreg y1 x1 x2 , var2(y2 x3 x4) wmfile(SPWcs) model(gs3sls) eq(1) order(1)

* (18-2) Generalized Spatial 3SLS - AR(2) (GS3SLS): spautoreg y1 x1 x2 , var2(y2 x3 x4) wmfile(SPWcs) model(gs3sls) eq(1) mfx(lin) > order(2)

* (18-3) Generalized Spatial 3SLS - AR(3) (GS3SLS): spautoreg y1 x1 x2 , var2(y2 x3 x4) wmfile(SPWcs) model(gs3sls) eq(1) mfx(lin) > order(3)

* (18-4) Generalized Spatial 3SLS - AR(4) (GS3SLS): spautoreg y1 x1 x2 , var2(y2 x3 x4) wmfile(SPWcs) model(gs3sls) eq(1) mfx(lin) > order(4) -------------------------------------------------------------------------------

* (19) Generalized Spatial Autoregressive 3SLS - (GS3SLSAR): * (19-1) Generalized Spatial Autoregressive 3SLS - AR(1) (GS3SLSAR): spautoreg y1 x1 x2 , var2(y2 x3 x4) wmfile(SPWcs) model(gs3slsar) eq(1) lmn lmh spautoreg y1 x1 x2 , var2(y2 x3 x4) wmfile(SPWcs) model(gs3slsar) eq(1) mfx(lin > ) order(1) lmn

* (19-2) Generalized Spatial Autoregressive 3SLS - AR(2) (GS3SLSAR): spautoreg y1 x1 x2 , var2(y2 x3 x4) wmfile(SPWcs) model(gs3slsar) eq(1) mfx(lin > ) order(2)

* (19-3) Generalized Spatial Autoregressive 3SLS - AR(3) (GS3SLSAR): spautoreg y1 x1 x2 , var2(y2 x3 x4) wmfile(SPWcs) model(gs3slsar) eq(1) mfx(lin > ) order(3)

* (19-4) Generalized Spatial Autoregressive 3SLS - AR(4) (GS3SLSAR): spautoreg y1 x1 x2 , var2(y2 x3 x4) wmfile(SPWcs) model(gs3slsar) eq(1) mfx(lin > ) order(4) -------------------------------------------------------------------------------

* (14) Spatial Autoregressive Generalized Method of Moments (SPGMM) (Cont.): This example is taken from Prucha data about: Generalized Moments Estimator for the Autoregressive Parameter in a Spatial Mo > del More details can be found in: http://econweb.umd.edu/~prucha/Research_Prog1.htm Results of model(spgmm) is identical to: http://econweb.umd.edu/~prucha/STATPROG/OLS/PROGRAM1.log

clear all sysuse spautoreg1.dta , clear spautoreg y x1 , wmfile(SPWcs1) model(spgmm) -------------------------------------------------------------------------------

* (16) Generalized Spatial Autoregressive 2SLS (GS2SLSAR) (Cont.): This example is taken from Prucha data about: Generalized Spatial Two-Stage Least Squares Procedures for Estimating a Spatial Autoregressive Model with Autoregressive Disturbances More details can be found in: http://econweb.umd.edu/~prucha/Research_Prog2.htm Results of model(gs2slsar) with order(2) is identical to: http://econweb.umd.edu/~prucha/STATPROG/2SLS/PROGRAM2.log

clear all sysuse spautoreg2.dta , clear spautoreg y x1 , wmfile(SPWcs1) model(gs2slsar) order(2) -------------------------------------------------------------------------------

* (17) Generalized Spatial Autoregressive 3SLS (GS3SLSAR) (Cont.): This example is taken from Prucha data about: Estimation of Simultaneous Systems of Spatially Interrelated Cross Sectional E > quations More details can be found in: http://econweb.umd.edu/~prucha/Research_Prog4.htm Results of model(gs3slsar) with order(2) is identical to: http://econweb.umd.edu/~prucha/STATPROG/SIMEQU/PROGRAM4.log

clear all sysuse spautoreg3.dta , clear spautoreg y1 x1 , var2(y2 x2) wmfile(SPWcs1) model(gs3slsar) order(2) -------------------------------------------------------------------------------

. clear all . sysuse spautoreg.dta, clear . spautoreg y x1 x2 , wmfile(SPWcs) model(sar) mfx(lin) test

============================================================================== *** Binary (0/1) Weight Matrix: 49x49 (Non Normalized) ==============================================================================

============================================================================== * MLE Spatial Lag Normal Model (SAR) ============================================================================== y = x1 + x2 ------------------------------------------------------------------------------ Sample Size = 49 | Cross Sections Number = Wald Test = 56.4471 | P-Value > Chi2(2) = 0.0000 F-Test = 28.2236 | P-Value > F(2 , 47) = 0.0000 (Buse 1973) R2 = 0.5510 | Raw Moments R2 = 0.9184 (Buse 1973) R2 Adj = 0.5414 | Raw Moments R2 Adj = 0.9166 Root MSE (Sigma) = 11.3305 | Log Likelihood Function = -186.8161 ------------------------------------------------------------------------------ - R2h= 0.5510 R2h Adj= 0.5415 F-Test = 28.23 P-Value > F(2 , 47) 0.0000 - R2v= 0.5543 R2v Adj= 0.5448 F-Test = 28.61 P-Value > F(2 , 47) 0.0000 ------------------------------------------------------------------------------ y | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- y | x1 | -.252788 .1007052 -2.51 0.012 -.4501667 -.0554094 x2 | -1.585978 .3198759 -4.96 0.000 -2.212924 -.959033 _cons | 64.04514 6.233457 10.27 0.000 51.82779 76.26249 -------------+---------------------------------------------------------------- Rho | .0211161 .0197638 1.07 0.285 -.0176202 .0598524 Sigma | 10.94111 1.10546 9.90 0.000 8.774445 13.10777 ------------------------------------------------------------------------------ LR Test SAR vs. OLS (Rho=0): 1.1415 P-Value > Chi2(1) 0.2853 Acceptable Range for Rho: -0.3199 < Rho < 0.1633 ------------------------------------------------------------------------------

============================================================================== * Model Selection Diagnostic Criteria - Model= (sar) ============================================================================== - Log Likelihood Function LLF = -186.8161 --------------------------------------------------------------------------- - Akaike Information Criterion (1974) AIC = 139.1818 - Akaike Information Criterion (1973) Log AIC = 4.9358 --------------------------------------------------------------------------- - Schwarz Criterion (1978) SC = 156.2734 - Schwarz Criterion (1978) Log SC = 5.0516 --------------------------------------------------------------------------- - Amemiya Prediction Criterion (1969) FPE = 136.2414 - Hannan-Quinn Criterion (1979) HQ = 145.4344 - Rice Criterion (1984) Rice = 140.3238 - Shibata Criterion (1981) Shibata = 138.2198 - Craven-Wahba Generalized Cross Validation (1979) GCV = 139.7269 ------------------------------------------------------------------------------

============================================================================== *** Spatial Aautocorrelation Tests - Model= (sar) ============================================================================== Ho: Error has No Spatial AutoCorrelation Ha: Error has Spatial AutoCorrelation

- GLOBAL Moran MI = 0.1476 P-Value > Z( 1.984) 0.0472 - GLOBAL Geary GC = 0.7581 P-Value > Z(-1.861) 0.0627 - GLOBAL Getis-Ords GO = -0.7111 P-Value > Z(-1.980) 0.0476 ------------------------------------------------------------------------------ - Moran MI Error Test = 0.6624 P-Value > Z(8.047) 0.5077 ------------------------------------------------------------------------------ - LM Error (Burridge) = 2.3900 P-Value > Chi2(1) 0.1221 - LM Error (Robust) = 2.9300 P-Value > Chi2(1) 0.0869 ------------------------------------------------------------------------------ Ho: Spatial Lagged Dependent Variable has No Spatial AutoCorrelation Ha: Spatial Lagged Dependent Variable has Spatial AutoCorrelation

- LM Lag (Anselin) = 0.0097 P-Value > Chi2(1) 0.9215 - LM Lag (Robust) = 0.5497 P-Value > Chi2(1) 0.4585 ------------------------------------------------------------------------------ Ho: No General Spatial AutoCorrelation Ha: General Spatial AutoCorrelation

- LM SAC (LMErr+LMLag_R) = 2.9397 P-Value > Chi2(2) 0.2300 - LM SAC (LMLag+LMErr_R) = 2.9397 P-Value > Chi2(2) 0.2300 ------------------------------------------------------------------------------

============================================================================== * Heteroscedasticity Tests - Model= (sar) ============================================================================== Ho: Homoscedasticity - Ha: Heteroscedasticity ------------------------------------------------------------------------------ - Hall-Pagan LM Test: E2 = Yh = 0.9799 P-Value > Chi2(1) 0.3222 - Hall-Pagan LM Test: E2 = Yh2 = 0.5735 P-Value > Chi2(1) 0.4489 - Hall-Pagan LM Test: E2 = LYh2 = 1.1041 P-Value > Chi2(1) 0.2934 ------------------------------------------------------------------------------ - Harvey LM Test: LogE2 = X = 2.7678 P-Value > Chi2(2) 0.2506 - Wald LM Test: LogE2 = X = 6.8293 P-Value > Chi2(1) 0.0090 - Glejser LM Test: |E| = X = 7.1015 P-Value > Chi2(2) 0.0287 ------------------------------------------------------------------------------ - Machado-Santos-Silva Test: Ev=Yh Yh2 = 2.8060 P-Value > Chi2(2) 0.2459 - Machado-Santos-Silva Test: Ev=X = 7.0429 P-Value > Chi2(2) 0.0296 ------------------------------------------------------------------------------ - White Test -Koenker(R2): E2 = X = 7.1879 P-Value > Chi2(2) 0.0275 - White Test -B-P-G (SSR): E2 = X = 9.9225 P-Value > Chi2(2) 0.0070 ------------------------------------------------------------------------------ - White Test -Koenker(R2): E2 = X X2 = 7.5497 P-Value > Chi2(4) 0.1095 - White Test -B-P-G (SSR): E2 = X X2 = 10.4218 P-Value > Chi2(4) 0.0339 ------------------------------------------------------------------------------ - White Test -Koenker(R2): E2 = X X2 XX= 18.7572 P-Value > Chi2(5) 0.0021 - White Test -B-P-G (SSR): E2 = X X2 XX= 25.8930 P-Value > Chi2(5) 0.0001 ------------------------------------------------------------------------------ - Cook-Weisberg LM Test E2/Sig2 = Yh = 1.3527 P-Value > Chi2(1) 0.2448 - Cook-Weisberg LM Test E2/Sig2 = X = 9.9225 P-Value > Chi2(2) 0.0070 ------------------------------------------------------------------------------ *** Single Variable Tests (E2/Sig2): - Cook-Weisberg LM Test: x1 = 0.8877 P-Value > Chi2(1) 0.3461 - Cook-Weisberg LM Test: x2 = 4.5468 P-Value > Chi2(1) 0.0330 ------------------------------------------------------------------------------ *** Single Variable Tests: - King LM Test: x1 = 0.0468 P-Value > Chi2(1) 0.8287 - King LM Test: x2 = 4.7943 P-Value > Chi2(1) 0.0286 ------------------------------------------------------------------------------

============================================================================== * Non Normality Tests - Model= (sar) ============================================================================== Ho: Normality - Ha: Non Normality ------------------------------------------------------------------------------ *** Non Normality Tests: - Jarque-Bera LM Test = 1.6737 P-Value > Chi2(2) 0.4331 - White IM Test = 5.4242 P-Value > Chi2(2) 0.0664 - Doornik-Hansen LM Test = 3.8663 P-Value > Chi2(2) 0.1447 - Geary LM Test = -3.3066 P-Value > Chi2(2) 0.1914 - Anderson-Darling Z Test = 0.3147 P > Z( 0.181) 0.5716 - D'Agostino-Pearson LM Test = 2.5887 P-Value > Chi2(2) 0.2741 ------------------------------------------------------------------------------ *** Skewness Tests: - Srivastava LM Skewness Test = 0.4911 P-Value > Chi2(1) 0.4835 - Small LM Skewness Test = 0.6007 P-Value > Chi2(1) 0.4383 - Skewness Z Test = -0.7750 P-Value > Chi2(1) 0.4383 ------------------------------------------------------------------------------ *** Kurtosis Tests: - Srivastava Z Kurtosis Test = 1.0875 P-Value > Z(0,1) 0.2768 - Small LM Kurtosis Test = 1.9880 P-Value > Chi2(1) 0.1585 - Kurtosis Z Test = 1.4100 P-Value > Chi2(1) 0.1585 ------------------------------------------------------------------------------ Skewness Coefficient = -0.2452 - Standard Deviation = 0.3398 Kurtosis Coefficient = 3.7611 - Standard Deviation = 0.6681 ------------------------------------------------------------------------------ Runs Test: (14) Runs - (23) Positives - (26) Negatives Standard Deviation Runs Sig(k) = 3.4501 , Mean Runs E(k) = 25.4082 95% Conf. Interval [E(k)+/- 1.96* Sig(k)] = (18.6460 , 32.1703 ) ------------------------------------------------------------------------------

============================================================================== *** Tobit Heteroscedasticity LM Tests Model= (sar) ============================================================================== Separate LM Tests - Ho: Homoscedasticity - LM Test: x1 = 0.8065 P-Value > Chi2(1) 0.3692 - LM Test: x2 = 8.2353 P-Value > Chi2(1) 0.0041

Joint LM Test - Ho: Homoscedasticity - LM Test = 8.2933 P-Value > Chi2(2) 0.0158

============================================================================== *** Tobit Non Normality LM Tests - Model= (sar) ============================================================================== LM Test - Ho: No Skewness - LM Test = 0.4723 P-Value > Chi2(1) 0.4919

LM test - Ho: No Kurtosis - LM Test = 2.5256 P-Value > Chi2(1) 0.1120

LM Test - Ho: Normality (No Kurtosis, No Skewness) - Pagan-Vella LM Test = 2.5809 P-Value > Chi2(2) 0.2751 - Chesher-Irish LM Test = 48.9962 P-Value > Chi2(2) 0.0000 ------------------------------------------------------------------------------

============================================================================== *** REgression Specification Error Tests (RESET) - Model= (sar) ============================================================================== Ho: Model is Specified - Ha: Model is Misspecified ------------------------------------------------------------------------------ * Ramsey Specification ResetF Test - Ramsey RESETF1 Test: Y= X Yh2 = 1.466 P-Value > F(1, 45) 0.2324 - Ramsey RESETF2 Test: Y= X Yh2 Yh3 = 0.717 P-Value > F(2, 44) 0.4940 - Ramsey RESETF3 Test: Y= X Yh2 Yh3 Yh4 = 1.214 P-Value > F(3, 43) 0.3162 ------------------------------------------------------------------------------ * DeBenedictis-Giles Specification ResetL Test - Debenedictis-Giles ResetL1 Test = 1.304 P-Value > F(2, 44) 0.2818 - Debenedictis-Giles ResetL2 Test = 0.986 P-Value > F(4, 42) 0.4253 - Debenedictis-Giles ResetL3 Test = 0.940 P-Value > F(6, 40) 0.4772 ------------------------------------------------------------------------------ * DeBenedictis-Giles Specification ResetS Test - Debenedictis-Giles ResetS1 Test = 1.632 P-Value > F(2, 44) 0.2071 - Debenedictis-Giles ResetS2 Test = 1.697 P-Value > F(4, 42) 0.1688 - Debenedictis-Giles ResetS3 Test = 1.990 P-Value > F(6, 40) 0.0900 ------------------------------------------------------------------------------ - White Functional Form Test: E2= X X2 = 7.550 P-Value > Chi2(1) 0.0229 ------------------------------------------------------------------------------

* Beta, Total, Direct, and InDirect (Model= sar): Linear: Marginal Effect *

+------------------------------------------------------------------------------ > -+ | Variable | Beta(B) | Total | Direct | InDirect | Mean > | |--------------+------------+------------+------------+------------+----------- > -| |y | | | | | > | | x1 | -0.2528 | -0.2522 | -0.2266 | -0.0256 | 38.4362 > | | x2 | -1.5860 | -1.5824 | -1.4218 | -0.1606 | 14.3749 > | +------------------------------------------------------------------------------ > -+

* Beta, Total, Direct, and InDirect (Model= sar): Linear: Elasticity *

+------------------------------------------------------------------------------ > -+ | Variable | Beta(Es) | Total | Direct | InDirect | Mean > | |--------------+------------+------------+------------+------------+----------- > -| | x1 | -0.2766 | -0.2760 | -0.2480 | -0.0280 | 38.4362 > | | x2 | -0.6490 | -0.6475 | -0.5818 | -0.0657 | 14.3749 > | +------------------------------------------------------------------------------ > -+ Mean of Dependent Variable = 35.1288

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

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

- David Drukker, and Ingmar Prucha for writing sppack.

- Maurizio Pisati for stata module spatreg.

- Wilner Jeanty for stata module spmlreg.

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

Emad Abd Elmessih Shehata Professor (PhD Economics) 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 (2012) SPAUTOREG: "Spatial Cross Sections Regression Models: (SAR-SEM-SDM-SAC-SARARGS-SARARIV-SARARML-SPGMM- GS2SLS-GS2SLSAR-GS3SLS-GS3SLSAR-IVTOBIT)"

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

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

Online Help:

*** Spatial Econometrics Regression Models:

------------------------------------------------------------------------------- > - *** (1) Spatial Panel Data Regression Models: spregxt Spatial Panel Regression Econometric Models: Stata Module Toolkit gs2slsxt Generalized Spatial Panel 2SLS Regression gs2slsarxt Generalized Spatial Panel Autoregressive 2SLS Regression spglsxt Spatial Panel Autoregressive Generalized Least Squares Regression spgmmxt Spatial Panel Autoregressive Generalized Method of Moments Regress > ion spmstarxt (m-STAR) Spatial Lag Panel Models spmstardxt (m-STAR) Spatial Durbin Panel Models spmstardhxt (m-STAR) Spatial Durbin Multiplicative Heteroscedasticity Panel Mo > dels spmstarhxt (m-STAR) Spatial Lag Multiplicative Heteroscedasticity Panel Model > s spregdhp Spatial Panel Han-Philips Linear Dynamic Regression: Lag & Durbin > Models spregdpd Spatial Panel Arellano-Bond Linear Dynamic Regression: Lag & Durbi > n Models spregfext Spatial Panel Fixed Effects Regression: Lag & Durbin Models spregrext Spatial Panel Random Effects Regression: Lag & Durbin Models spregsacxt MLE Spatial AutoCorrelation Panel Regression (SAC) spregsarxt MLE Spatial Lag Panel Regression (SAR) spregsdmxt MLE Spatial Durbin Panel Regression (SDM) spregsemxt MLE Spatial Error Panel Regression (SEM) ------------------------------------------------------------------------------- > - *** (2) Spatial Cross Section Regression Models: spregcs Spatial Cross Section Regression Econometric Models: Stata Module > Toolkit gs2sls Generalized Spatial 2SLS Cross Sections Regression gs2slsar Generalized Spatial Autoregressive 2SLS Cross Sections Regression gs3sls Generalized Spatial Autoregressive 3SLS Regression gs3slsar Generalized Spatial Autoregressive 3SLS Cross Sections Regression gsp3sls Generalized Spatial 3SLS Cross Sections Regression spautoreg Spatial Cross Section Regression Models spgmm Spatial Autoregressive GMM Cross Sections Regression spmstar (m-STAR) Spatial Lag Cross Sections Models spmstard (m-STAR) Spatial Durbin Cross Sections Models spmstardh (m-STAR) Spatial Durbin Multiplicative Heteroscedasticity Cross Se > ctions Models spmstarh (m-STAR) Spatial Lag Multiplicative Heteroscedasticity Cross Secti > ons Models spregsac MLE Spatial AutoCorrelation Cross Sections Regression (SAC) spregsar MLE Spatial Lag Cross Sections Regression (SAR) spregsdm MLE Spatial Durbin Cross Sections Regression (SDM) spregsem MLE Spatial Error Cross Sections Regression (SEM) ------------------------------------------------------------------------------- > - *** (3) Tobit Spatial Regression Models:

*** (3-1) Tobit Spatial Panel Data Regression Models: sptobitgmmxt Tobit Spatial GMM Panel Regression sptobitmstarxtTobit (m-STAR) Spatial Lag Panel Models sptobitmstardxtTobit (m-STAR) Spatial Durbin Panel Models sptobitmstardhxtTobit (m-STAR) Spatial Durbin Multiplicative Heteroscedasticity > Panel Models sptobitmstarhxtTobit (m-STAR) Spatial Lag Multiplicative Heteroscedasticity Pan > el Models sptobitsacxt Tobit MLE Spatial AutoCorrelation (SAC) Panel Regression sptobitsarxt Tobit MLE Spatial Lag Panel Regression sptobitsdmxt Tobit MLE Spatial Panel Durbin Regression sptobitsemxt Tobit MLE Spatial Error Panel Regression spxttobit Tobit Spatial Panel Autoregressive GLS Regression -------------------------------------------------------------- *** (3-2) Tobit Spatial Cross Section Regression Models: sptobitgmm Tobit Spatial GMM Cross Sections Regression sptobitmstar Tobit (m-STAR) Spatial Lag Cross Sections Models sptobitmstardTobit (m-STAR) Spatial Durbin Cross Sections Models sptobitmstardhTobit (m-STAR) Spatial Durbin Multiplicative Heteroscedasticity C > ross Sections sptobitmstarhTobit (m-STAR) Spatial Lag Multiplicative Heteroscedasticity Cross > Sections sptobitsac Tobit MLE AutoCorrelation (SAC) Cross Sections Regression sptobitsar Tobit MLE Spatial Lag Cross Sections Regression sptobitsdm Tobit MLE Spatial Durbin Cross Sections Regression sptobitsem Tobit MLE Spatial Error Cross Sections Regression ------------------------------------------------------------------------------- > - *** (4) Spatial Weight Matrix: spcs2xt Convert Cross Section to Panel Spatial Weight Matrix spweight Cross Section and Panel Spatial Weight Matrix spweightcs Cross Section Spatial Weight Matrix spweightxt Panel Spatial Weight Matrix ------------------------------------------------------------------------------- > -