help: spregxt dialog:

Title

spregxt: Spatial Panel Econometric Regression Models: Stata Module Toolkit

Table of Contents

Syntax

Description

Options

Model Options

Run Options

Ridge Options

Weight Options

Weighted Variable Type Options

Other Options

Spatial Panel Aautocorrelation Tests

Model Selection Diagnostic Criteria

Autocorrelation Tests

Heteroscedasticity Tests

Non Normality Tests

Error Component Tests

Unit Roots Tests

Hausman Fixed/Random Effects & Specification Panel/IV-Panel Tests

Identification Restrictions LM Tests

REgression Specification Error Tests (RESET)

Linear vs Log-Linear Functional Form Tests

Multicollinearity Diagnostic Tests

Saved Results

References

*** Examples

Acknowledgments

Author

Syntax

spregxt depvar indepvars [weight] , nc(#)

[ wmfile(weight_file) model(sar|sem|sdm|sac|gwr|mstar|mstard|spgmm|gs2sls|gs2slsar|ols|sarxt|sdmxt)

run(ols|xtabond|xtam|xtbe|xtbem|xtdhp|xtdpd|xtdpdsys|xtfe|xtfem|xtfm|xtfrontier|)

(xtgls|xthh|xtkmhet1|xtkmhet2|xtkmhomo|xtmg|xtmle|xtmln|xtmlh|xtbn|xtpa|)
(xtparks|xtpcse|xtrc|xtre|xtrem|xtregar|xtsa|xtmlem|xttobit|xtwem|xtwh)

weights(yh|yh2|abse|e2|le2|x|xi|x2|xi2) wvar(varname) ridge(orr|grr1|grr2|grr3) kr(#)

lmspac lmauto lmhet lmform lmnorm lmec lmcl lmunit lmiden hausman reset diag tests

stand inv inv2 dn dist(norm|exp|weib) pmfx mfx(lin, log) spar(rho, lam) aux(varlist)

mhet(varlist) nwmat(#) order(#) gmm(#) inrho(real 0) inlambda(real 0) noconstant

predict(new_var) resid(new_var) inst(vars) diff(vars) endog(vars) pre(vars)

dgmmiv(varlist) corr(name) panels(name) rhotype(name) iter(#) tech(name) ll(real 0)

be fe re coll cost te ti tvd ec2sls igls hetonly indep zero dumcs(prefix) dumts(prefix)

dlag(#) nosa tobit tolog nolog robust twostep level(#) list

vce(vcetype) maximize other maximization options ]

Description

spregxt is a complete Stata module toolkit package
for Spatial Panel Econometric Regression Models estimation
Many types of spatial autocorrelations were taken under consedration, i.e.,
(SAR - SEM - SDM - SAC - SPGMM - GS2SLS - GS2SLSAR) Regressions.

spregxt can estimate the following models:
1- Autocorrelated (serial correlation) Regression Models.
2- Heteroscedastic Regression Models in disturbance term.
3- Non Normal Regression Models in disturbance term.
4- Multicollinearity Regression Models in independent variables.

In fact spregxt estimates many Spatial & Non Spatial Models, even OLS regression:

- spregxt varlist , nc(#) model(ols) run(ols)
without choosing: wmfile( )
spregxt results are identical OLS as regress

- spregxt varlist , nc(#) model(ols) run(xtbe, xtfe, xtre, xtmle, xtpa, xtgls, ...)
without choosing: wmfile( )
spregxt results are identical Panel as xtreg and more XT commands.

- ALL Diagnostic tests also are valid in the case of all models.

spregxt estimates Continuous and Truncated Dependent Variables models tobit.

model(sar, sem, sdm, sac, mstar,mstard, 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 panel model via xttobit model,
and thus spregxt 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.

*** Important Notes:
spregxt 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

spregxt can generate:

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

spregxt 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).

- DF=N-K for OLS model , and DF=N-K-nc otherwise.

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)

Options

* nc(#) Number of Cross Sections Units
Time series observations must be Balanced in each Cross Section

wmfile(weight_file) Open CROSS SECTION weight matrix file.
spregxt will convert automatically spatial cross section weight matrix
to spatial PANEL weight matrix.

Spatial Weight Matrix file must be:
1- [SxS] Cross Sections units Dimentions, and not Panel dimentions
2- Square Matrix
3- Symmetric Matrix (Optional)

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

stand Use Standardized Panel Weight Matrix, (each row sum equals 1)
Default is Binary spatial panel weight matrix which each element is 0 or 1

inv Use Inverse Standardized Weight Matrix (1/W)

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

be Between Effects (BE) model(gs2sls, gs2slsar), run(xthdp)
fe Fixed-Effects (FE) model(gs2sls, gs2slsar), run(xtregar, xthdp)
re GLS-Random-Effects (RE) model(gs2sls, gs2slsar), run(xthdp)

Model Options

model(sar, sem, sdm, sac, mstar,mstard, spgmm, gs2sls, gs2slsar, ols, sarxt, sdmxt)

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

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

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

4- model(sac) MLE Spatial Panel Lag / Error Model (SAC) "Spatial AutoCorrelation"

5- model(mstar) Multiparametric Spatio Temporal AutoRegressive Regression Model

mSTAR Lag Model

6- model(mstard) Multiparametric Spatio Temporal AutoRegressive Regression Model

mSTAR Durbin Model

model(mstar, mstard) are used with more than Weight Matrix: (Border, Language, Currency, Trade...)

7- model(spgmm) Spatial Panel Autoregressive Generalized Method of Moments Model

When panel data model with error components are both spatially and time-wise correlated.
Generalized Method of Moments (GMM) that suggested in Kelejian-Prucha (1999), and Kapoor-Kelejian-Prucha (2007) is used in the estimation of model(spgmm)

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

9- model(gs2sls) Generalized Spatial Panel 2SLS

10- model(gs2slsar) Generalized Spatial Panel Autoregressive 2SLS

Since no softwares available till now to estimate generalized spatial panel autoregressive 2SLS models, I designed gs2slsar as a modification of Kapoor-Kelejian-Prucha (2007),
but here I let the estimations deal with Panel 2SLS models, with original constant term.

11- model(gwr) Geographically Weighted Regressions (GWR)

12- model(ols) Linear Panel Models (Non Spatial)

13- model(sarxt) Linear Spatial Panel Lag Models (SAR)

14- model(sdmxt) Linear Spatial Panel Durbin Models (SDM)

Run Options

run( ) is used with Spatial: model(ols, sarxt, sdmxt)

1- run(ols) [regress] Ordinary Least Squares (OLS)
2- run(xtbe) [xtreg , be] Between-Effects Panel Regression
3- run(xtbem) [NEW] Between-Effects Panel Regression
4- run(xtfe) [xtreg , fe] Fixed-Effects Panel Regression
5- run(xtfem) [NEW] Fixed-Effects Panel Regression
6- run(xtpa) [xtreg , pa] Population Averaged-Effects Panel Regression

7- run(xtmle) [xtreg , mle] MLE Random-Effects Panel Regression
8- run(xtam) [NEW] Amemiya Random-Effects Panel Regression
9- run(xtbn) [NEW] Balestra-Nerlove Random-Effects Panel Regression
10- run(xtfm) [NEW] Fama-MacBeth Panel Regression
11- run(xthh) [NEW] Hildreth-Houck Random Coefficients Panel Regression
12- run(xtrc) [xtrc] Swamy Random Coefficients Panel Regression
13- run(xtre) [xtreg , re] GLS Random-Effects Panel Regression
14- run(xtrem) [NEW] Fuller-Battese GLS Random-Effects Panel Regression
15- run(xtsa) [NEW] Swamy-Arora Random-Effects Panel Regression
16- run(xtmlem) [NEW] Trevor Breusch MLE Random-Effects Panel Regression
17- run(xtwem) [NEW] Within-Effects Panel Regression
18- run(xtwh) [NEW] Wallace-Hussain Random-Effects Panel Regression

19- run(xtgls) [xtgls] Autocorrelation & Heteroskedasticity GLS Panel Regression
20- run(xtkmhomo) [xtgls] Kmenta Homoscedastic GLS AR(1) Panel Regression
* with Options: panels(iid) corr(psar1)
21- run(xtkmhet1) [xtgls] Kmenta Heteroscedastic GLS - different AR(1) in each Panel
* with Options: panels(het) corr(psar1)
22- run(xtkmhet2) [xtgls] Kmenta Heteroscedastic GLS - SAME/Common AR(1) in all Panels
* with Options: panels(het) corr(ar1)
23- run(xtparks) [xtgls] Parks Full Heteroscedastic Cross-Section GLS AR(1) Panel Regression
* with Options: panels(corr) corr(psar1)

24- run(xtmg) [xtmg] Heterogeneous Slopes Time Series Panel Regression

Requires (xtmg) module ssc install xtmg

25- run(xtpcse) [xtpcse] Corrected Standard Error Panel Regression
26- run(xtregar) [xtregar] AR(1) Panel Regression

27- run(xtabond) [xtabond] Arellano-Bond Linear Dynamic Panel Regression
28- run(xtdhp) [NEW] Han-Philips (2010) Linear Dynamic Panel Regression
29- run(xtdpd) [xtdpd] Arellano-Bond (1991) Linear Dynamic Panel Regression
30- run(xtdpdsys) [xtdpdsys] Arellano-Bover/Blundell-Bond (1995, 1998)
System Linear Dynamic Panel Regression

31- run(xtfrontier) [xtfrontier] Stochastic Frontier Panel Regression

32- run(xttobit) [xttobit] Tobit Random-Effects Panel Regression

33- run(xtmln) [NEW] MLE Random-Effects Panel Regression
* Normal Model
34- run(xtmlh) [NEW] MLE Random-Effects Panel Regression
* Multiplicative Heteroscedasticity Normal Model

Ridge Options

kr(#) Ridge k value, must be in the range (0 < k < 1).

IF kr(0) in ridge(orr, grr1, grr2, grr3), the model will be normal panel regression.

ridge(orr) : Ordinary Ridge Regression [Judge,et al(1988,p.878) eq.21.4.2].
ridge(grr1): Generalized Ridge Regression [Judge,et al(1988,p.881) eq.21.4.12].
ridge(grr2): Iterative Generalized Ridge [Judge,et al(1988,p.881) eq.21.4.12].
ridge(grr3): Adaptive Generalized Ridge [Strawderman(1978)].

ridge( ) works only with:
model(ols, sarxt, sdmxt, spgmm)
run(ols, xtam, xtbem, xtbn, xtfem, xtrem, xtsa, xtmlem, xtwem, xtwh)

spregxt estimates Ridge regression as a multicollinearity remediation method.

General form of Ridge Coefficients and Covariance Matrix are:

Br = inv[X'X + kI] X'Y

Cov=Sig^2 * inv[X'X + kI] (X'X) inv[X'X + kI]

where:
Br = Ridge Coefficients Vector (k x 1).
Cov = Ridge Covariance Matrix (k x k).
Y = Dependent Variable Vector (N x 1).
X = Independent Variables Matrix (N x k).
k = Ridge Value (0 < k < 1).
I = Diagonal Matrix of Cross Product Matrix (Xs'Xs).
Xs = Standardized Variables Matrix in Deviation from Mean.
Sig2 = (Y-X*Br)'(Y-X*Br)/DF

Weight Options

wvar(varname) Weighted Variable Name

spregxt not like official Stata command xtreg in weight option,
spregxt can use large types of weighted regression options with:
1- Fixed-Effects run(xtfem)
2- Between-Effects run(xtbem)
2- Within-Effects run(xtwem)
3- Random-Effects run(xtrem, xtmlem, xtbn, xtam, xtwh, ... etc)
wvar( ) must be combined with: weights(x, xi, x2, xi2)"

Weighted Variable Type Options

weights(yh) Yh - Predicted Value

weights(yh2) Yh^2 - Predicted Value Squared

weights(abse) abs(E) - Absolute Value of Residual

weights(e2) E^2 - Residual Squared

weights(le2) log(E^2) - Log Residual Squared

weights(x) (x) Variable

weights(xi) (1/x) Inverse Variable

weights(x2) (x^2) Squared Variable

weights(xi2) (1/x^2) Inverse Squared Variable

Other Options

dlag(#) Location of Lagged Dependent Variable; default is (1)

zero convert missing values observations to Zero

list Add Spatial Lagged Variables to Data File

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

nwmat(1,2,3,4) number of Rho's matrixes to be used with: model(mstar, mstard)}

gmm(1,2,3) GMM Estimators for model(spgmm)

1- Initial GMM Model
2- Partial Weighted GMM Model
3- Full Weighted GMM Model

coll keep collinear variables; default is removing collinear variables.

cost Fit Cost Frontier instead of Production Function run(xtfrontier)

te List Confidence Intervals for Technical Efficiency Estimates run(xtfrontier)

ti use Time-Invariant model run(xtfrontier)

tvd use Time-Varying Decay model run(xtfrontier)

ec2sls Baltagi EC2SLS Random-Effects (RE) Model model(gs2sls, gs2slsar)

noconstant Exclude Constant Term from Equation
not valid in model(sem, sac)
spregxt not like official Stata command xtreg in constant term option,
spregxt can exclude constant term from models with:
1- Fixed-Effects xtfem
3- Random-Effects xtrem
2- Between-Effects xtbem
weights option also can be used here.

hausman Hausman Fixed Effects & Specification Tests

hetonly assume panel-level heteroskedastic errors run(xtpcse)

igls iterated GLS instead of two-step GLS run(xtgls)

indep assume independent errors across panels run(xtpcse)

tests display ALL lma, lmh, lmn, lmsp, lmec, lmu, lmi, diag, reset, haus tests

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

nosa Baltagi-Chang variance components instead of Swamy-Arora model(gs2sls, gs2slsar)

twostep two-step estimate run(xtregar, xtdpd)

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(spgmm) via Tobit Spatial Panel GMM

ll(#) value of minimum left-censoring dependent variable with:
model(sar, sem, sdm, sac, spgmm), and run(xttobit); default is 0

pmfx Print Marginal Effects P-Values.

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, mstar, mstard) 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, mstar, mstard)
- spar(rho) cannot be used with model(sem)

- spar(lam) is default for model(sem)
- spar(lam) cannot be used with model(sar, sdm, mstar, mstard)
- spar(lam) is an alternative with model(sac)

- model(sac) work with the two types spar(rho, lam)
- model(sarxt, gs2sls, gs2slsar) 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) is used with model(sar, sem, sdm, sac, mstar, mstard).

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 in model(sdm, sdmxt, mstard)
to avoid lost degrees of freedom (DF). Using many dummy variables must be used
with caution to avoid multicollinearity problem, that causes singular matrix,
and lead to abort estimation. aux( ) not works with model(sem, sac).

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

Panel Multiplicative Heteroscedasticity can be used also with with
model(ols, sarxt, sdmxt) with combining run(xtmlh)
to remidy Heteroscedasticity, option [weight], can not be used here.

panels:(iid) Homoscedastic Error with No Cross-Sections Correlation
run(xtgls, xtpcse, xtregar)
panels:(het) Heteroscedastic Error with No Cross-Sections Correlation
run(xtgls, xtpcse, xtregar)
panels:(corr) Heteroscedastic Error with Cross-Sections Correlation
run(xtgls, xtpcse, xtregar)

corr:(indep) No Autocorrelation within Panels
run(xtgls, xtpcse, xtregar)
corr:(ar1) Common AR(1) Autocorrelation within Panels
run(xtgls, xtpcse, xtregar)
corr:(psar1) AR(1) Autocorrelation within Panels, and in each Panel
run(xtgls, xtpcse, xtregar)
corr:(corr) Autocorrelation within Panels
run(xtgls ,xtpcse, xtregar, xtmle, xtpa)

rhotype(rhomethod) types of Rho estimators run(xtpcse, xtregar):

rhotype(dw) Durbin-Watson: rho_dw = 1 - dw/2

rhotype(regress) rho_reg = B from residual regression e_t = B*e_(t-1)

rhotype(freg) rho_leads = B from residual regression e_t = B*e_(t+1)

rhotype(tscorr) time series autocorrelation: rho_tscorr = e'e_(t-1)/e'e

rhotype(theil) Theil = rho_tscorr * (N-k)/N

rhotype(nagar) rho_nagar = (rho_dw * N*N+k*k)/(N*N-k*k)

rhotype(onestep) rho_onestep = (n/m_c)*rho_tscorr, where n is obs. and m_c is number of consecutive pairs of residuals

predict(new_variable) Predicted values variable

resid(new_variable) Residuals values variable
computed as Ue=Y-Yh ; that is known as combined residual: [Ue = U_i + E_it]
in xtreg models overall error component is computed as: [E_it]
see: xtreg postestimation

dgmmiv(varlist) GMM Instruments for Differenced Equation run(xtdpd)

diff(varlist) Already Differenced Exogenous Variables run(xtabond)

endog(varlist) Endogenous Variables run(xtabond, xtdpdsys)
endog(vars) allows to add other additional Endogenous Variables
in model(gs2sls, gs2slsar)

inst(varlist) add Additional Instrumental Variables run(xtabond)
and with model(gs2sls, gs2slsar)
Dependent Variable Lag length is lag(1) for run(xtabond, xtdpdsys)
if the same variables are included in aux(varlist),
so Instrumental Variables will be Exogenous variables in RHS side

spregxt command:
spregxt y1 x1 x2, nc(7) wmfile(SPWxt) model(gs2sls) endog(y2) inst(x3 x4)

is identical to
xtivreg y1 x1 x2 (w1y_y1 y2 = x1 x2 x3 x4 w1x_x1 w1x_x2)

***Both additional Endogenous and Instrumental Variables in:
model(gs2sls, gs2slsar)
will be added without converting them to spatial lagged variables

pre(varlist) Predetermined Variables run(xtabond, xtdpdsys)

dumcs(new_varlist) Cross Section Dummy Variables Prefix

dumts(new_varlist) Time Series Dummy Variables Prefix

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

tech(name) technique algorithm for maximization of the log likelihood function 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 achieved 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 Panel Aautocorrelation Tests

lmspac Spatial Panel 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 countries

- 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: Y = BX + rWy + LW1y + e ; e = lW1e+u
- Geographically Weighted Regression: wY = wBX ; e = lWe+u

- General Spatial Model is used to deal with both types of spatial dependence,
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 information,
which is related to greater uncertainty, less precision, and larger standard 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 error,
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 specification
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 dependence,
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

Panel Model Selection Diagnostic Criteria

diag Spatial Panel 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

Panel Serial Autocorrelation Tests

lmauto Spatial Panel Serial Autocorrelation Tests:

* Ho: No AR(1) Panel AutoCorrelation - Ha: AR(1) Panel AutoCorrelation
- Durbin h Panel Test (Lag DepVar)
- Harvey LM Panel Test (Lag DepVar)
- Panel Rho Value
- Durbin-Watson Panel Test
- Von Neumann Ratio Panel Test
- Box-Pierce LM Panel Test
- Z Panel Test
- Durbin m Panel Test (drop 1 cs obs)
- Durbin m Panel Test (keep 1 cs obs)
- Breusch-Godfrey LM Test (drop 1 cs obs)
- Breusch-Godfrey LM Test (keep 1 cs obs)
- Breusch-Pagan-Godfrey Z (keep 1 obs)
- Breusch-Pagan-Godfrey Z (drop 1 cs obs)
- Breusch-Pagan-Godfrey Z (keep 1 cs obs)
- Baltagi LM Panel Test
- Baltagi Z Panel Test
- Wooldridge F Panel Test
- Wooldridge LM Panel Test

Panel Heteroscedasticity Tests

lmhet Spatial Panel Heteroscedasticity Tests:

* Ho: Panel Homoscedasticity - Ha: Panel Heteroscedasticity
- Engle LM ARCH Test AR(1) E2 =E2_1
- 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
- Breusch-Godfrey Test: E = E_1 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

*** Groupwise Panel Heteroscedasticity Tests
* Ho: Panel Homoscedasticity - Ha: Panel Groupwise Heteroscedasticity
- Lagrange Multiplier LM Test
- Likelihood Ratio LR Test
- Wald Test

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

Panel Non Normality Tests

lmnorm Spatial Panel Non Normality Tests:

* Ho: Panel Normality - Ha: Panel 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 Panel 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

Panel Error Component Tests

lmec Spatial Panel Error Component Tests:

* Panel Random Effects Tests
Ho: Fixed Effects Model (FEM) - Ha: Random Effects Model (REM)
Ho: No AR(1) Autocorrelation - Ha: AR(1) Autocorrelation
- Breusch-Pagan LM Test - Two Side
- Breusch-Pagan ALM Test - Two Side
- Sosa-Escudero-Yoon LM Test - One Side
- Sosa-Escudero-Yoon ALM Test - One Side
- Baltagi-Li LM Autocorrelation Test
- Baltagi-Li ALM Autocorrelation Test
- Baltagi-Li LM AR(1) Joint Test

* Panel Diagonal Covariance Matrix Test
Ho: OLS - Ha: Panel
- Breusch-Pagan LM Test

* Contemporaneous Correlations Across Cross Sctions Test
Ho: No Contemporaneous Correlations (Independence) - (OLS)
Sig12 = Sig13 = Sig23 = ... = 0.
Ha: Contemporaneous Correlations (Dedependence) - (Panel)
at least one Covariance is nonzero.

- Panel estimation models assume:

1- Independence of the errors in each cross section or no correlations between different periods in the same cross section.

2- no correlations between the errors for any of two cross sections between two different periods, this is called "Intertemporal Correlation".

3- correlations may be exist between different two cross sections, but at the same period, and this is called "Contemporaneous Correlation".

4- Panel models can be applied when there is correlations between different two cross sections at the same period.

5- If "Contemporaneous Correlation" does not exist, ordinary least squares (OLS) can be applied, the results are fully efficient.

Breusch-Pagan LM can test whether contemporaneous diagonal covariance matrix is 0. (Independence of the Errors), or correlated if at least one covariance is nonzero.

Using model(xtgls, xtkmhomo, xtkmhet1, xtkmhet2, xtparks, xtpcse)
are solutions for (Contemporaneous Correlation)
- Breusch-Pagan Diagonal Covariance Matrix Panel LM Test
- Breusch-Pagan Cross-Section Independence Panel LM Test
Results of the two tests with [run(xtfe) lmec] are identical
LM= Lagrange Multiplier ; ALM = Adjusted Lagrange Multiplier

Panel Unit Roots Tests

lmunit Panel Unit Roots Tests:

* Ho: All Panels are Stationary - Ha: Some Panels Have Unit Roots
- Hadri Z Test (No Trend - No Robust)
- Hadri Z Test (No Trend - Robust)
- Hadri Z Test ( Trend - No Robust)
- Hadri Z Test ( Trend - Robust)
Using run(xtabond, xtdhp, xtdpd, xtdpdsys)
are solutions for (Non Stationary Models)

Panel Hausman Fixed/Random Effects & Specification Panel/IV-Panel Tests

hausman Spatial Panel Hausman Fixed Effects & Specification Tests:

* Ho: Random Effects Model (REM) - Ha: Fixed Effects Model (FEM)
- Hausman Panel Model vs IV-Panel Model
- Hausman Fixed Effects vs Random Effects

Panel Identification Restrictions LM Tests

lmiden Spatial Panel 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

Panel REgression Specification Error Tests (RESET)

reset Spatial Panel REgression Specification Error Tests (RESET)

* Ho: Panel Model is Specified - Ha: Panel 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

Panel Linear vs Log-Linear Functional Form Tests

lmform Spatial Panel Linear vs Log-Linear Functional Form Tests

- R-squared
- Log Likelihood Function (LLF)
- Antilog R2
- Box-Cox Test
- Bera-McAleer BM Test
- Davidson-Mackinnon PE Test

Panel Multicollinearity Diagnostic Tests

lmcl Spatial Panel Multicollinearity Diagnostic Tests

- works if there are two independent variables or more in the model.
* Correlation Matrix
* Multicollinearity Diagnostic Criteria
* Farrar-Glauber Multicollinearity Tests
Ho: No Multicollinearity - Ha: Multicollinearity
* (1) Farrar-Glauber Multicollinearity Chi2-Test
* (2) Farrar-Glauber Multicollinearity F-Test
* (3) Farrar-Glauber Multicollinearity t-Test
* Multicollinearity Ranges
* Determinant of |X'X|
* Theil R2 Multicollinearity Effect:
- Gleason-Staelin Q0
- Heo Range Q1

- Multicollinearity Detection:

1. A high F statistic or R2 leads to reject the joint hypothesis that all of the coefficients are zero, but individual t-statistics are low.

2. High simple correlation coefficients are sufficient but not necessary for multicollinearity.

3. One can compute condition number. That is, the ratio of largest to smallest root of the matrix x'x. This may not always be useful as the standard errors of the estimates depend on the ratios of elements of characteristic vectors to the roots.

- Multicollinearity Remediation:

1. Use prior information or restrictions on the coefficients. One clever way to do this was developed by Theil and Goldberger. See tgmixed, and Theil(1971, pp 347-352).

2. Use additional data sources. This does not mean more of the same. It means pooling cross section and time series.

3. Transform the data. For example, inversion or differencing.

4. Use a principal components estimator. This involves using a weighted average of the regressors, rather than all of the regressors.

5. Another alternative regression technique is ridge regression. This involves putting extra weight on the main diagonal of X'X.

6. Dropping troublesome RHS variables. This begs the question of specification error.

Saved Results

Depending on the model estimated, spregxt saves the following results in e():

Scalars

*** Spatial Panel 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

*** Spatial Panel 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

*** Spatial Panel Serial Autocorrelation Tests:
e(rho) Panel Rho Value
e(lmadw) Durbin-Watson Panel Test
e(lmavon) Von Neumann Ratio Panel Test
e(lmabp) Box-Pierce LM Panel Test
e(lmabpp) Box-Pierce LM Panel Test P-Value
e(lmaz) Z Panel Test
e(lmazp) Z Panel Test P-Value
e(lmadh) Durbin h Panel Test (Lag DepVar)
e(lmadhp) Durbin h Panel Test (Lag DepVar) P-Value
e(lmahh) Harvey LM Panel Test (Lag DepVar)
e(lmahhp) Harvey LM Panel Test (Lag DepVar) P-Value
e(lmadmd) Durbin m Panel Test (drop 1 cs obs)
e(lmadmdp) Durbin m Panel Test (drop 1 cs obs) P-Value
e(lmadmk) Durbin m Panel Test (keep 1 cs obs)
e(lmadmkp) Durbin m Panel Test (keep 1 cs obs) P-Value
e(lmabgd) Breusch-Godfrey LM Test (drop 1 cs obs)
e(lmabgdp) Breusch-Godfrey LM Test (drop 1 cs obs) P-Value
e(lmabgk) Breusch-Godfrey LM Test (keep 1 cs obs)
e(lmabgkp) Breusch-Godfrey LM Test (keep 1 cs obs) P-Value
e(lmabpgk) Breusch-Pagan-Godfrey Z Test (keep 1 obs)
e(lmabpgkp) Breusch-Pagan-Godfrey Z Test (keep 1 obs) P-Value
e(lmabpgd) Breusch-Pagan-Godfrey Z Test (drop 1 cs obs)
e(lmabpgdp) Breusch-Pagan-Godfrey Z Test (drop 1 cs obs) P-Value
e(lmabpgk1) Breusch-Godfrey LM Test (keep 1 obs)
e(lmabpgk1p) Breusch-Godfrey LM Test (keep 1 obs) P-Value
e(lmab1) Baltagi LM Panel Test
e(lmab1p) Baltagi LM Panel Test P-Value
e(lmab2) Baltagi Z Panel Test
e(lmab2p) Baltagi Z Panel Test P-Value
e(lmawold1) Wooldridge F Panel Test
e(lmawold1p) Wooldridge F Panel Test P-Value
e(lmawold2) Wooldridge LM Panel Test
e(lmawold2p) Wooldridge LM Panel Test P-Value

*** Spatial Panel Heteroscedasticity Tests:
e(lmharch) Engle LM ARCH Test AR(1)
e(lmharchp) Engle LM ARCH Test AR(1) P-Value
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(lmhbg) Breusch-Godfrey Test
e(lmhbgp) Breusch-Godfrey 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

*** Spatial Panel Groupwise Heteroscedasticity Tests:
e(lmhglm) Lagrange Multiplier LM Test
e(lmhglmp) Lagrange Multiplier LM Test P-Value
e(lmhglr) Likelihood Ratio LR Test
e(lmhglrp) Likelihood Ratio LR Test P-Value
e(lmhgw) Wald Test
e(lmhgwp) Wald Test P-Value

*** Spatial Panel 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

*** Spatial Panel Error Component Tests:
e(lmec1) Breusch-Pagan Random Effects Test LM Test -Two Side
e(lmec1p) Breusch-Pagan Random Effects Test LM Test -Two Side P-Value
e(lmec2) Breusch-Pagan Random Effects Test ALM Test -Two Side
e(lmec2p) Breusch-Pagan Random Effects Test ALM Test -Two Side P-Value
e(lmec3) Sosa-Escudero-Yoon Random Effects Test LM Test -One Side
e(lmec3p) Sosa-Escudero-Yoon Random Effects Test LM Test -One Side P-Value
e(lmec4) Sosa-Escudero-Yoon Random Effects Test ALM Test -One Side
e(lmec4p) Sosa-Escudero-Yoon Random Effects Test ALM Test -One Side P-Value
e(lmec5) Baltagi-Li Random Effects Test LM Autocorrelation Test
e(lmec5p) Baltagi-Li Random Effects Test LM Autocorrelation Test P-Value
e(lmec6) Baltagi-Li Random Effects Test ALM Autocorrelation Test
e(lmec6p) Baltagi-Li Random Effects Test ALM Autocorrelation Test P-Value
e(lmec7) Baltagi-Li Random Effects Test LM AR(1) Joint Test
e(lmec7p) Baltagi-Li Random Effects Test LM AR(1) Joint Test P-Value
e(lmec8) Breusch-Pagan Diagonal Covariance Matrix Test LM Test
e(lmec8p) Breusch-Pagan Diagonal Covariance Matrix Test LM Test P-Value
e(lmec9) Breusch-Pagan Cross-Section Independence LM Test
e(lmec9p) Breusch-Pagan Cross-Section Independence LM Test P-Value

*** Spatial Panel Unit Roots Tests:
e(lmu1) Hadri Z Test (No Trend - No Robust)
e(lmu1p) Hadri Z Test (No Trend - No Robust) P-Value
e(lmu2) Hadri Z Test (No Trend - Robust)
e(lmu2p) Hadri Z Test (No Trend - Robust) P-Value
e(lmu3) Hadri Z Test ( Trend - No Robust)
e(lmu3p) Hadri Z Test ( Trend - No Robust) P-Value
e(lmu4) Hadri Z Test ( Trend - Robust)
e(lmu4p) Hadri Z Test ( Trend - Robust) P-Value

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

*** Panel Hausman Fixed/Random Effects Tests:
e(lmhsfe) Hausman Fixed Effects vs Random Effects
e(lmhsfep) Hausman Fixed Effects vs Random Effects P-Value

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

*** Spatial Panel 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

*** Spatial Panel Linear vs Log-Linear Functional Form Tests:
e(r2lin) Linear R2
e(r2log) Log-Log R2
e(llflin) LLF - Linear
e(llflog) LLF - Log-Log
e(r2lina) Antilog R2 Linear vs Log-Log: R2Lin
e(r2loga) Antilog R2 Log-Log vs Linear: R2log
e(boxcox) Box-Cox Test
e(boxcoxp) Box-Cox Test P-Value
e(bmlin) Bera-McAleer BM Test - Linear ModeL
e(bmlinp) Bera-McAleer BM Test - Linear ModeL P-Value
e(bmlog) Bera-McAleer BM Test - Log-Log ModeL
e(bmlogp) Bera-McAleer BM Test - Log-Log ModeL P-Value
e(dmlin) Davidson-Mackinnon PE Test - Linear ModeL
e(dmlinp) Davidson-Mackinnon PE Test - Linear ModeL P-Value
e(dmlog) Davidson-Mackinnon PE Test - Log-Log ModeL
e(dmlogp) Davidson-Mackinnon PE Test - Log-Log ModeL P-Value

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

References

Amemiya, Takeshi (1971)
"The Estimation of the Variances in a Variance-Components Model",
International Economic Review, Vol. 12, No. 1, Feb.; 1-13.

Anderson, T.W. & C. Hsiao (1982)
"Formulation and Estimation of Dynamic Models Using Panel Data",
Journal of Econometrics, 18; 47–82.

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.

Anselin L., Le Gallo J. & Jayet H (2006)
"Spatial Panel Econometrics"
In: Matyas L, Sevestre P. (eds) The Econometrics of Panel Data, Fundamentals and Recent Developments in Theory and Practice, 3rd edn. Kluwer, Dordrecht; 901-969.

Arellano, M. and S. Bond (1991)
"Some Tests of Specification for Panel Data: Monte Carlo Evidence and an Application to Employment Equations"
The Review of Economic Studies 58; 277-297.

Arellano, M. and S. Bond (1998)
"Dynamic Panel Data Estimation Using DPD98 for Gauss"
: A Guide for Users.

Arellano, M. and O. Bover (1995)
"Another Look at the Instrumental Variable Estimation of Error-Components Models"
Journal of Econometrics 68; 29-51.

Balestra, Pietro (1973)
"Best Quadratic Unbiased Estimators of the Variance-Covariance Matrix in Normal Regression",
Journal of Econometrics, 2; 17–28.

Balestra, Pietro & Marc Nerlove (1966)
"Pooling Cross-Section and Time Series Data in the Estimation of a Dynamic Model: The Demand for Natural Gas",
Econometrica, Vol. 34, No. 3, July; 585-612.

Baltagi, B.H. (2006)
"Random Effects and Spatial Autocorrelation with Equal Weights"
Econometric Theory 22(5); 973-984.

Baltagi, B. H. & Q. Li (1995)
"Testing AR (1) against MA (1) Disturbances in an Error Component Model"
Journal of Econometrics 68; 133-151.

Baltagi, B. H., & Q. Li. 1991
"A Joint Test for Serial Correlation and Random Individual Effects"
Statistics and Probability Letters 11; 277-280.

Baltagi, B. H., Song S.H., Jung BC, & Koh W (2007)
"Testing for Serial Correlation, Spatial Autocorrelation and Random Effects Using Panel Data"
Journal of Econometrics 140(1); 5-51.

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.

Bera, A., W. Sosa-Escudero, & M. Yoon (2001)
"Tests for the Error Component Model in the Presence of Local Misspecification"
Journal of Econometrics 101; 1-23.

Box, George & Pierce D. (1970)
"Distribution of Residual Autocorrelations in Autoregressive Integrated Moving Average Time Series Models",
Journal of the American Statisical Association, 65; 1509-1526.

Breusch, Trevor (1978)
"Testing for Autocorrelation in Dynamic Linear Models",
Aust. Econ. Papers, Vol. 17; 334-355.

Breusch, Trevor (1987)
"Maximum Likelihood Estimation of Random Effects Models",
Journal of Econometrics, 36; 383–389.

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, Vol. 28; 281-298.

Buse, Adolf (1973)
"Goodness of Fit in Generalized Least Squares Estimation"
American Statistician, Vol. 27(3); 106-108.

Buse, Adolf (1979)
"Goodness of Fit in the Seemingly Unrelated Regressions Model"
Journal of Econometrics, Vol. 10; 109-113.

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.

DeBenedictis, L. F. & Giles D. E. A. (1998)
"Diagnostic Testing in Econometrics: Variable Addition, RESET and Fourier Approximations",
In: A. Ullah & D. E. A. Giles (Eds.), Handbook of Applied Economic Statistics. Marcel Dekker, New York; 383-417.

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.

Durbin, James (1970b)
"An Alternative to the Bounds Test for Testing for Serial Correlation in Least Square Regression",
Econometrica, Vol. 38, No. 2, May; 422-429.

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.

Engle, Robert (1982)
"Autoregressive Conditional Heteroscedasticity with Estimates of Variance of United Kingdom Inflation"
Econometrica, 50(4), July; 987-1007.

Fama, E. F., & J. D. MacBeth (1973)
"Risk, Return, and Equilibrium: Empirical Tests"
Journal of Political Economy, Vol. 81, Issue 3; 607-636.

Fuller, W.A. & G.E. Battese (1974)
"Estimation of Linear Models with Cross-Error Structure",
Journal of Econometrics, 2; 67–78.

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 Higher Order Serial Correlation in Regression Equations when the Regressors Include Lagged Dependent Variables",
Econometrica, Vol.46; 1303-1310.

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.

Han, Chirok & Peter C.B. Phillips (2010)
"GMM Estimation for Dynamic Panels with Fixed Effects and Strong at Unity"
Econometric Theory, 26; 119–151.

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.

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.

Hays, Jude C., Aya Kachi & Robert J. Franzese, Jr (2010)
"A Spatial Model Incorporating Dynamic, Endogenous Network Interdependence: A Political Science Application",
Statistical Methodology 7(3); 406-428.

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.S. (1971)
"The Use of Variance Components Models in Pooling Cross Section and Time Series Data",
Econometrica, 39; 341–358.

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

Maddala, G.S. & T. Mount (1973)
"A Comparative Study of Alternative Estimators for Variance Components Models Used in Econometric Applications",
Journal of the American Statistical Association, 68; 324–328.

Mudit Kapoor, Harry H. Kelejian & Ingmar R. Prucha (2007)
"Panel Data Models with Spatially Correlated Error Components",
Journal of Econometrics, 140; 97-130.
http://econweb.umd.edu/~prucha/Papers/JE140(2007a).pdf

Nerlove, Marc (1971)
"A Note on Error Components Models",
Econometrica, Vol. 39, No. 2, March; 383-396.

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

Parks, R. (1967)
"Efficient Estimation of a System of Regression Equations when Disturbances are Both Serially and Contemporaneously Correlated",
Journal of the American Statisical Association, 62; 500-509.

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.

Sosa-Escudero, & Bera, A. (2008)
"Tests for unbalanced error-components models under local misspecification"
The Stata Journal, 8(1); 68–78.

Swamy, P.A.V.B. (1970)
"Efficient Inference in a Random Coefficient Regression Model"
Econometrica 38; 311-323.

Swamy, P.A.V.B. & S.S. Arora (1972)
"The Exact Finite Sample Properties of the Estimators of Coefficients in the Error Components Regression Models",
Econometrica, 40; 261–275.

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.

Von, Neumann (1941)
"Distribution of the Ratio of the Mean Square Successive Difference to the Variance",
Annals Math. Stat., Vol. 12; 367-395.

Wallace, T. & A. Hussain (1969)
"The Use of Error Components Models in Combining Cross-Section and Time-Series Data",
Econometrica, 37; 55–72.

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

Wooldridge, Jeffrey M. (2002)
"Econometric Analysis of Cross Section and Panel Data",
The MIT Press, Cambridge, Massachusetts, London, England.

Examples

Note 1: you can use: spweight, spweightcs, spweightxt to create Spatial Weight Matrix.
Note 2: Remember, your spatial weight matrix must be:
*** 1-Cross Section Dimention 2- Square Matrix 3- Symmetric Matrix
Note 3: You can use the dialog box for .
Note 4: xtset is included automatically in spregxt models.

clear all

sysuse spregxt.dta, clear

db spregxt

spregxt y x1 x2 , nc(7) model(ols) run(ols)
spregxt y x1 x2 , nc(7) model(ols) run(xtrem)
spregxt y x1 x2 , nc(7) model(ols) run(xtrem) ridge(grr1) weight(x) wvar(x1)

spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(sar) mfx(lin)
spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(sar) mfx(lin) stand tests

* (1) MLE Spatial Panel Lag Model (SAR):
spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(sar) tests
spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(sar) tests mfx(lin) pmfx
spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(sar) mfx(log) pmfx tolog
spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(sar) predict(Yh) resid(Ue)
spregxt ys x1 x2, nc(7) wmfile(SPWxt) model(sar) tobit ll(0)
spregxt ys x1 x2, nc(7) wmfile(SPWxt) model(sar) tobit ll(3)

* (2) MLE Spatial Panel Error Model (SEM):
spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(sem) mfx(lin)
spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(sem) mfx(log) tolog
spregxt ys x1 x2, nc(7) wmfile(SPWxt) model(sem) tobit ll(0)

* (3) MLE Spatial Panel Durbin Model (SDM):
spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(sdm) mfx(lin) pmfx
spregxt ys x1 x2, nc(7) wmfile(SPWxt) model(sdm) tobit ll(0)
spregxt y x1 , nc(7) wmfile(SPWxt) model(sdm) mfx(lin) aux(x2)
spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(sdm) mfx(log) pmfx tolog

local dum "dcs1 dcs2 dcs3 dcs4"
spregxt y x1 x2, nc(7) wmfile(SPWxt) model(sdm) aux(`dum')
spregxt y x1 x2 dcs1-dcs5, nc(7) wmfile(SPWxt) model(sdm) noconst

* (4) MLE Spatial Panel AutoCorrelation Model (SAC):
spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(sac) mfx(lin) pmfx spar(rho)
spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(sac) mfx(log) pmfx spar(rho) tolog
spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(sac) mfx(lin) pmfx spar(lam)
spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(sac) mfx(log) pmfx spar(lam) tolog
spregxt ys x1 x2, nc(7) wmfile(SPWxt) model(sac) tobit ll(0)

* (5) Spatial Panel Autoregressive Generalized Method of Moments
spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(spgmm) mfx(lin)
spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(spgmm) gmm(1)
spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(spgmm) gmm(2)
spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(spgmm) gmm(3)

* (6) Tobit Spatial Panel Autoregressive Generalized Method of Moments
spregxt ys x1 x2 , nc(7) wmfile(SPWxt) model(spgmm) gmm(1) tobit ll(0)
spregxt ys x1 x2 , nc(7) wmfile(SPWxt) model(spgmm) gmm(2) tobit ll(0)
spregxt ys x1 x2 , nc(7) wmfile(SPWxt) model(spgmm) gmm(3) tobit ll(0)

* (7) Generalized Spatial Panel 2SLS Models

spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(gs2sls) endog(y2) inst(x3 x4)
spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(gs2sls) order(1) lmi haus
spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(gs2sls) order(2) lmi haus
spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(gs2sls) order(3) lmi haus
spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(gs2sls) order(4) lmi haus

* (8) Generalized Spatial Panel Autoregressive 2SLS Models
spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(gs2slsar) endog(y2) inst(x3 x4)
spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(gs2slsar) order(1) lmi haus
spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(gs2slsar) order(2) lmi haus
spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(gs2slsar) order(3) lmi haus
spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(gs2slsar) order(4) lmi haus

* (9) (m-STAR) Multiparametric Spatio Temporal AutoRegressive Regression
*** YOU MUST HAVE DIFFERENT Weighted Matrixes Files:
* (m-STAR) Lag Model

* (9-1) *** rum mstar in 1st nwmat
spregxt y x1 x2 , nc(7) wmfile(SPWmxt1) nwmat(1) model(mstar) mfx(lin) pmfx dist(norm)
spregxt y x1 x2 , nc(7) wmfile(SPWmxt1) nwmat(1) model(mstar) mfx(lin) pmfx dist(exp)
spregxt y x1 x2 , nc(7) wmfile(SPWmxt1) nwmat(1) model(mstar) mfx(lin) pmfx dist(weib)
spregxt y x1 x2 , nc(7) wmfile(SPWmxt1) nwmat(1) model(mstar) mfx(lin) pmfx mhet(x1 x2)

spregxt ys x1 x2, nc(7) wmfile(SPWmxt1) nwmat(1) model(mstar) tobit ll(0)

* (9-2) *** Import 1 Weight Matrix, and rum mstar in 2nd nwmat
spregxt y x1 x2 , nc(7) wmfile(SPWmxt1) nwmat(1)
spregxt y x1 x2 , nc(7) wmfile(SPWmxt2) nwmat(2) model(mstar) mfx(lin) pmfx dist(norm)
spregxt y x1 x2 , nc(7) wmfile(SPWmxt2) nwmat(2) model(mstar) mfx(lin) pmfx dist(exp)
spregxt y x1 x2 , nc(7) wmfile(SPWmxt2) nwmat(2) model(mstar) mfx(lin) pmfx dist(weib)
spregxt y x1 x2 , nc(7) wmfile(SPWmxt2) nwmat(2) model(mstar) mfx(lin) pmfx mhet(x1 x2)

spregxt ys x1 x2, nc(7) wmfile(SPWmxt2) nwmat(2) model(mstar) tobit ll(0)

* (9-3) *** Import 1,2 Weight Matrixes, and rum mstar in 3rd nwmat
spregxt y x1 x2 , nc(7) wmfile(SPWmxt1) nwmat(1)
spregxt y x1 x2 , nc(7) wmfile(SPWmxt2) nwmat(2)
spregxt y x1 x2 , nc(7) wmfile(SPWmxt3) nwmat(3) model(mstar) mfx(lin) pmfx dist(norm)
spregxt y x1 x2 , nc(7) wmfile(SPWmxt3) nwmat(3) model(mstar) mfx(lin) pmfx dist(exp)
spregxt y x1 x2 , nc(7) wmfile(SPWmxt3) nwmat(3) model(mstar) mfx(lin) pmfx dist(weib)
spregxt y x1 x2 , nc(7) wmfile(SPWmxt3) nwmat(3) model(mstar) mfx(lin) pmfx mhet(x1 x2)

spregxt ys x1 x2, nc(7) wmfile(SPWmxt3) nwmat(3) model(mstar) tobit ll(0)

* (9-4) *** Import 1,2,3 Weight Matrixes, and rum mstar in 4th nwmat
spregxt y x1 x2 , nc(7) wmfile(SPWmxt1) nwmat(1)
spregxt y x1 x2 , nc(7) wmfile(SPWmxt2) nwmat(2)
spregxt y x1 x2 , nc(7) wmfile(SPWmxt3) nwmat(3)
spregxt y x1 x2 , nc(7) wmfile(SPWmxt4) nwmat(4) model(mstar) mfx(lin) pmfx dist(norm)
spregxt y x1 x2 , nc(7) wmfile(SPWmxt4) nwmat(4) model(mstar) mfx(lin) pmfx dist(exp)
spregxt y x1 x2 , nc(7) wmfile(SPWmxt4) nwmat(4) model(mstar) mfx(lin) pmfx dist(weib)
spregxt y x1 x2 , nc(7) wmfile(SPWmxt4) nwmat(4) model(mstar) mfx(lin) pmfx mhet(x1 x2)

spregxt ys x1 x2, nc(7) wmfile(SPWmxt4) nwmat(4) model(mstar) tobit ll(0)

* (10) (m-STAR) Multiparametric Spatio Temporal AutoRegressive Regression
*** YOU MUST HAVE DIFFERENT Weighted Matrixes Files:
* (m-STAR) Durbin Model

* (10-1) *** rum mstar in 1st nwmat
spregxt y x1 x2 , nc(7) wmfile(SPWmxt1) nwmat(1) model(mstard) mfx(lin) pmfx dist(norm)
spregxt y x1 x2 , nc(7) wmfile(SPWmxt1) nwmat(1) model(mstard) mfx(lin) pmfx dist(exp)
spregxt y x1 x2 , nc(7) wmfile(SPWmxt1) nwmat(1) model(mstard) mfx(lin) pmfx dist(weib)
spregxt y x1 x2 , nc(7) wmfile(SPWmxt1) nwmat(1) model(mstard) mfx(lin) pmfx mhet(x1 x2)

spregxt ys x1 x2, nc(7) wmfile(SPWmxt1) nwmat(1) model(mstard) mfx(lin) pmfx tobit ll(0)

* (10-2) *** Import 1 Weight Matrix, and rum mstar in 2nd nwmat
spregxt y x1 x2 , nc(7) wmfile(SPWmxt1) nwmat(1)
spregxt y x1 x2 , nc(7) wmfile(SPWmxt2) nwmat(2) model(mstard) mfx(lin) pmfx dist(norm)
spregxt y x1 x2 , nc(7) wmfile(SPWmxt2) nwmat(2) model(mstard) mfx(lin) pmfx dist(exp)
spregxt y x1 x2 , nc(7) wmfile(SPWmxt2) nwmat(2) model(mstard) mfx(lin) pmfx dist(weib)
spregxt y x1 x2 , nc(7) wmfile(SPWmxt2) nwmat(2) model(mstard) mfx(lin) pmfx mhet(x1 x2)

spregxt ys x1 x2, nc(7) wmfile(SPWmxt2) nwmat(2) model(mstard) mfx(lin) pmfx tobit ll(0)

* (10-3) *** Import 1,2 Weight Matrixes, and rum mstar in 3rd nwmat
spregxt y x1 x2 , nc(7) wmfile(SPWmxt1) nwmat(1)
spregxt y x1 x2 , nc(7) wmfile(SPWmxt2) nwmat(2)
spregxt y x1 x2 , nc(7) wmfile(SPWmxt3) nwmat(3) model(mstard) mfx(lin) pmfx dist(norm)
spregxt y x1 x2 , nc(7) wmfile(SPWmxt3) nwmat(3) model(mstard) mfx(lin) pmfx dist(exp)
spregxt y x1 x2 , nc(7) wmfile(SPWmxt3) nwmat(3) model(mstard) mfx(lin) pmfx dist(weib)
spregxt y x1 x2 , nc(7) wmfile(SPWmxt3) nwmat(3) model(mstard) mfx(lin) pmfx mhet(x1 x2)

spregxt ys x1 x2, nc(7) wmfile(SPWmxt3) nwmat(3) model(mstard) mfx(lin) pmfx tobit ll(0)

* (10-4) *** Import 1,2,3 Weight Matrixes, and rum mstar in 4th nwmat
spregxt y x1 x2 , nc(7) wmfile(SPWmxt1) nwmat(1)
spregxt y x1 x2 , nc(7) wmfile(SPWmxt2) nwmat(2)
spregxt y x1 x2 , nc(7) wmfile(SPWmxt3) nwmat(3)
spregxt y x1 x2 , nc(7) wmfile(SPWmxt4) nwmat(4) model(mstard) mfx(lin) pmfx dist(norm)
spregxt y x1 x2 , nc(7) wmfile(SPWmxt4) nwmat(4) model(mstard) mfx(lin) pmfx dist(exp)
spregxt y x1 x2 , nc(7) wmfile(SPWmxt4) nwmat(4) model(mstard) mfx(lin) pmfx dist(weib)
spregxt y x1 x2 , nc(7) wmfile(SPWmxt4) nwmat(4) model(mstard) mfx(lin) pmfx mhet(x1 x2)

spregxt ys x1 x2, nc(7) wmfile(SPWmxt4) nwmat(4) model(mstard) mfx(lin) pmfx tobit ll(0)

* (11) Weighted MLE Spatial Panel Models:

* (1) Weighted MLE Spatial Panel Lag Model (SAR):
spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(sar) mfx(lin) pmfx wvar(x1)

* (2) Weighted MLE Spatial Panel Error Model (SEM):
spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(sem) wvar(x1)

* (3) Weighted MLE Spatial Panel Durbin Model (SDM):
spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(sdm) mfx(lin) pmfx wvar(x1)

* (4) Weighted MLE Spatial Panel AutoCorrelation Model (SAC):
spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(sac) mfx(lin) pmfx wvar(x1)

* (5) Weighted (m-STAR) Lag Model
spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(mstar) mfx(lin) pmfx nw(1) wvar(x1)

* (6) Weighted (m-STAR) Durbin Model
spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(mstard) mfx(lin) pmfx nw(1) wvar(x1)

* (12) Spatial Panel Tobit - Truncated Dependent Variable (ys)
spregxt ys x1 x2 , nc(7) wmfile(SPWxt) model(sar) mfx(lin) pmfx
spregxt ys x1 x2 , nc(7) wmfile(SPWxt) model(sem) mfx(lin)
spregxt ys x1 x2 , nc(7) wmfile(SPWxt) model(sdm) mfx(lin) pmfx
spregxt ys x1 x2 , nc(7) wmfile(SPWxt) model(sac) mfx(lin) pmfx
spregxt ys x1 x2 , nc(7) wmfile(SPWxt) model(sarxt) run(xttobit)
spregxt ys x1 x2 , nc(7) wmfile(SPWxt) model(sdmxt) run(xttobit)

* (13) Spatial Panel Multiplicative Heteroscedasticity
spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(sar) mhet(x1 x2)
spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(sdm) mhet(x1 x2)

* (14) Spatial Panel Exponential Regression Model
spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(sar) dist(exp)
spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(sem) dist(exp)
spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(sdm) dist(exp)
spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(sac) dist(exp)

* (15) Spatial Panel Weibull Regression Model
spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(sar) dist(weib)
spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(sem) dist(weib)
spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(sdm) dist(weib)
spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(sac) dist(weib)

* (16) Non Spatial Panel Regression Models

* Ordinary Least Squares (OLS) Regression:
* ols spregxt y x1 x2 , nc(7) model(ols) run(ols)
* Between-Effects Panel Regression:
* xtbe spregxt y x1 x2 , nc(7) model(ols) run(xtbe)
* Between-Effects Panel Regression:
* xtbem spregxt y x1 x2 , nc(7) model(ols) run(xtbem) ridge(grr1)
* Fixed-Effects Panel Regression:
* xtfe spregxt y x1 x2 , nc(7) model(ols) run(xtfe)
* Fixed-Effects Panel Regression:
* xtfem spregxt y x1 x2 , nc(7) model(ols) run(xtfem) ridge(grr1)
* Fama-MacBeth Panel Regression:
* xtfm spregxt y x1 x2 , nc(7) model(ols) run(xtfm)
* Population Averaged Effects Panel Regression:
* xtpa spregxt y x1 x2 , nc(7) model(ols) run(xtpa)
* Within-Effects Panel Regression:
* xtwem spregxt y x1 x2 , nc(7) model(ols) run(xtwem)
* Variance Components (Random-Effects) Panel Regression:
* Random-Effects MLE Panel Regression:
* xtmle spregxt y x1 x2 , nc(7) model(ols) run(xtmle)
* Amemiya Variance Components Panel Regression:
* xtam spregxt y x1 x2 , nc(7) model(ols) run(xtam)
* Balestra-Nerlove Variance Components Panel Regression:
* xtbn spregxt y x1 x2 , nc(7) model(ols) run(xtbn)
* Hildreth-Houck Random Coefficients Panel Regression:
* xthh spregxt y x1 x2 , nc(7) model(ols) run(xthh)
* Swamy Random-Coefficients Panel Regression:
* xtrc spregxt y x1 x2 , nc(7) model(ols) run(xtrc)
* Random-Effects GLS Panel Regression:
* xtre spregxt y x1 x2 , nc(7) model(ols) run(xtre)
* Fuller-Battese GLS Random Effect Panel Regression:
* xtrem spregxt y x1 x2 , nc(7) model(ols) run(xtrem) hausman ridge(grr1)
* Swamy-Arora Variance Components Panel Regression:
* xtsa spregxt y x1 x2 , nc(7) model(ols) run(xtsa)
* Trevor Breusch Random-Effects MLE Panel Regression:
* xtmlem spregxt y x1 x2 , nc(7) model(ols) run(xtmlem)
* Wallace-Hussain Variance Components Panel Regression:
* xtwh spregxt y x1 x2 , nc(7) model(ols) run(xtwh)
* Autocorrelation & Heteroskedasticity Generalized Least Squares Panel Regression:
* xtgls spregxt y x1 x2 , nc(7) model(ols) run(xtgls)
* Kmenta Homoscedastic Generalized Least Squares AR(1) Panel Regression:
* xtkmhomo spregxt y x1 x2 , nc(7) model(ols) run(xtkmhomo)
* Kmenta Heteroscedastic GLS AR(1) different in each Panel:
* xtkmhet1 spregxt y x1 x2 , nc(7) model(ols) run(xtkmhet1)
* Kmenta Heteroscedastic GLS AR(1) SAME/Common in all Panels:
* xtkmhet2 spregxt y x1 x2 , nc(7) model(ols) run(xtkmhet2)
* Parks (FULL) Heteroscedastic Cross-Section GLS AR(1) Panel Regression:
* xtparks spregxt y x1 x2 , nc(7) model(ols) run(xtparks)
* Panel Time Series with Heterogeneous Slopes Regression:
* xtmg spregxt y x1 x2 , nc(7) model(ols) run(xtmg)
* Linear Panel-Corrected Standard Error (PCSE) Regression:
* xtpcse spregxt y x1 x2 , nc(7) model(ols) run(xtpcse)
* Linear Panel AR(1) Regression:
* xtregar spregxt y x1 x2 , nc(7) model(ols) run(xtregar)
* Linear Dynamic Panel Regression:
local dum "dcs1 dcs2 dcs3 dcs4"
* Arellano-Bond Linear Dynamic Panel Regression:
* xtabond spregxt y x1 x2 , nc(7) model(ols) run(xtabond) inst(x1 x2)
* xtabond spregxt y x1 x2 , nc(7) model(ols) run(xtabond) inst(x1 x2) lag(1) pre(x1 x2) diff(`dum')
* Han-Philips (2010) Linear Dynamic Panel Regression:}
* xtdhp spregxt y x1 x2 , nc(7) model(ols) run(xtdhp) re
* Arellano-Bond (1991) Linear Dynamic Panel Regression:
* xtdpd spregxt y x1 x2 , nc(7) model(ols) run(xtdpd) dgmmiv(x1 x2)
* Arellano-Bover/Blundell-Bond (1995, 1998) System Linear Dynamic Panel Regression:
* xtdpdsys spregxt y x1 x2 , nc(7) model(ols) run(xtdpdsys) lag(1)
* Frontier Panel Regression:
* xtfrontier spregxt y x1 x2 , nc(7) model(ols) run(xtfrontier) ti
* xtfrontier spregxt y x1 x2 , nc(7) model(ols) run(xtfrontier) tvd
* xtfrontier spregxt y x1 x2 , nc(7) model(ols) run(xtfrontier) ti cost
* Tobit Panel Regression:
* xttobit spregxt y x1 x2 , nc(7) model(ols) run(xttobit)
* MLE Random-Effects Panel Regression - Normal Model:
* xtmln spregxt y x1 x2 , nc(7) model(ols) run(xtmln)
* MLE Random-Effects Multiplicative Heteroscedasticity Panel Regression:
* xtmlh spregxt y x1 x2 , nc(7) model(ols) run(xtmlh) mhet(x1 x2)

* (17) Spatial Panel Geographically Weighted Regressions (GWR)
* ols spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(gwr) run(ols)
* xtbe spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(gwr) run(xtbe)
* xtbem spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(gwr) run(xtbem) ridge(grr1)
* xtfe spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(gwr) run(xtfe)
* xtfem spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(gwr) run(xtfem) ridge(grr1)
* xtfm spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(gwr) run(xtfm)
* xtpa spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(gwr) run(xtpa)
* xtwem spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(gwr) run(xtwem)
* xtmle spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(gwr) run(xtmle)
* xtam spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(gwr) run(xtam)
* xtbn spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(gwr) run(xtbn)
* xthh spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(gwr) run(xthh)
* xtrc spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(gwr) run(xtrc)
* xtre spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(gwr) run(xtre) hausman
* xtrem spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(gwr) run(xtrem) hausman ridge(grr1)
* xtsa spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(gwr) run(xtsa)
* xtmlem spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(gwr) run(xtmlem)
* xtwh spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(gwr) run(xtwh)
* xtgls spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(gwr) run(xtgls)
* xtkmhomo spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(gwr) run(xtkmhomo)
* xtkmhet1 spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(gwr) run(xtkmhet1)
* xtkmhet2 spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(gwr) run(xtkmhet2)
* xtparks spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(gwr) run(xtparks)
* xtmg spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(gwr) run(xtmg)
* xtpcse spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(gwr) run(xtpcse)
* xtregar spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(gwr) run(xtregar)

* xtabond spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(gwr) run(xtabond) inst(x1 x2)
* xtdhp spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(gwr) run(xtdhp) re
* xtdpd spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(gwr) run(xtdpd) dgmmiv(x1 x2)
* xtdpdsys spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(gwr) run(xtdpdsys)

* xtmln spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(gwr) run(xtmln)
* xtmlh spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(gwr) run(xtmlh) mhet(x1 x2)
* xtfrontier spregxt y x1 x2, nc(7) wmfile(SPWxt) model(gwr) run(xtfrontier) ti
* xtfrontier spregxt y x1 x2, nc(7) wmfile(SPWxt) model(gwr) run(xtfrontier) tvd
* xtfrontier spregxt y x1 x2, nc(7) wmfile(SPWxt) model(gwr) run(xtfrontier) ti cost
* xttobit spregxt ys x1 x2, nc(7) wmfile(SPWxt) model(gwr) run(xttobit)

* (18) Spatial Panel Lag Regression Models (SAR)
* ols spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(sarxt) run(ols)
* xtbe spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(sarxt) run(xtbe)
* xtbem spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(sarxt) run(xtbem) ridge(grr1)
* xtfe spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(sarxt) run(xtfe)
* xtfem spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(sarxt) run(xtfem) ridge(grr1)
* xtfm spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(sarxt) run(xtfm)
* xtpa spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(sarxt) run(xtpa)
* xtwem spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(sarxt) run(xtwem)
* xtmle spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(sarxt) run(xtmle)
* xtam spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(sarxt) run(xtam)
* xtbn spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(sarxt) run(xtbn)
* xthh spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(sarxt) run(xthh)
* xtrc spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(sarxt) run(xtrc)
* xtre spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(sarxt) run(xtre) hausman
* xtrem spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(sarxt) run(xtrem) hausman ridge(grr1)
* xtsa spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(sarxt) run(xtsa)
* xtmlem spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(sarxt) run(xtmlem)
* xtwh spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(sarxt) run(xtwh)
* xtgls spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(sarxt) run(xtgls)
* xtkmhomo spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(sarxt) run(xtkmhomo)
* xtkmhet1 spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(sarxt) run(xtkmhet1)
* xtkmhet2 spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(sarxt) run(xtkmhet2)
* xtparks spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(sarxt) run(xtparks)
* xtmg spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(sarxt) run(xtmg)
* xtpcse spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(sarxt) run(xtpcse)
* xtregar spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(sarxt) run(xtregar)

* xtabond spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(sarxt) run(xtabond) inst(x1 x2)
* xtdhp spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(sarxt) run(xtdhp) re
* xtdpd spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(sarxt) run(xtdpd) dgmmiv(x1 x2)
* xtdpdsys spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(sarxt) run(xtdpdsys)

* xtmln spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(sarxt) run(xtmln)
* xtmlh spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(sarxt) run(xtmlh) mhet(x1 x2)
* xtfrontier spregxt y x1 x2, nc(7) wmfile(SPWxt) model(sarxt) run(xtfrontier) ti
* xtfrontier spregxt y x1 x2, nc(7) wmfile(SPWxt) model(sarxt) run(xtfrontier) tvd
* xtfrontier spregxt y x1 x2, nc(7) wmfile(SPWxt) model(sarxt) run(xtfrontier) ti cost
* xttobit spregxt ys x1 x2, nc(7) wmfile(SPWxt) model(sarxt) run(xttobit)

* (19) Spatial Panel Durbin Regression Models (SDM)
local dum "dcs1 dcs2 dcs3 dcs4 dcs5"
* ols spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(sdmxt) run(ols)
* xtbe spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(sdmxt) run(xtbe)
* xtbem spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(sdmxt) run(xtbem) ridge(grr1)
* xtfe spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(sdmxt) run(xtfe)
* xtfem spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(sdmxt) run(xtfem) ridge(grr1)
* xtfm spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(sdmxt) run(xtfm)
* xtpa spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(sdmxt) run(xtpa)
* xtwem spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(sdmxt) run(xtwem)
* xtmle spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(sdmxt) run(xtmle)
* xtam spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(sdmxt) run(xtam)
* xtbn spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(sdmxt) run(xtbn)
* xthh spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(sdmxt) run(xthh)
* xtrc spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(sdmxt) run(xtrc)
* xtre spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(sdmxt) run(xtre) hausman
* xtrem spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(sdmxt) run(xtrem) hausman ridge(grr1)
* xtsa spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(sdmxt) run(xtsa)
* xtmlem spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(sdmxt) run(xtmlem)
* xtwh spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(sdmxt) run(xtwh)
* xtgls spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(sdmxt) run(xtgls)
* xtkmhomo spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(sdmxt) run(xtkmhomo)
* xtkmhet1 spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(sdmxt) run(xtkmhet1)
* xtkmhet2 spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(sdmxt) run(xtkmhet2)
* xtparks spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(sdmxt) run(xtparks)
* xtmg spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(sdmxt) run(xtmg)
* xtpcse spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(sdmxt) run(xtpcse)
* xtregar spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(sdmxt) run(xtregar)

* xtabond spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(sdmxt) run(xtabond) inst(x1 x2)
* xtdhp spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(sdmxt) run(xtdhp) re
* xtdpd spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(sdmxt) run(xtdpd) dgmmiv(x1 x2)
* xtdpdsys spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(sdmxt) run(xtdpdsys)

* xtfrontier spregxt y x1 x2, nc(7) wmfile(SPWxt) model(sdmxt) run(xtfrontier) ti
* xtfrontier spregxt y x1 x2, nc(7) wmfile(SPWxt) model(sdmxt) run(xtfrontier) tvd
* xtfrontier spregxt y x1 x2, nc(7) wmfile(SPWxt) model(sdmxt) run(xtfrontier) ti cost
* xttobit spregxt ys x1 x2, nc(7) wmfile(SPWxt) model(sdmxt) run(xttobit)
* xtmln spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(sdmxt) run(xtmln)
* xtmlh spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(sdmxt) run(xtmlh) mhet(x1 x2)

* (20) Create Spatial Panel Variables:

spregxt y x1 x2 , nc(7) model(gs2sls) wmfile(SPWxt) order(1) list
list w1y_* w1x_*

spregxt y x1 x2 , nc(7) model(gs2sls) wmfile(SPWxt) order(1) stand inv list
list w1y_* w1x_*

spregxt y x1 x2 , nc(7) model(gs2sls) wmfile(SPWxt) order(1) stand inv2 list
list w1y_* w1x_*

spregxt y x1 x2 , nc(7) model(gs2sls) wmfile(SPWxt) order(1) stand list
list w1y_* w1x_*

spregxt y x1 x2 , nc(7) model(gs2sls) wmfile(SPWxt) order(2) list
list w1y_* w1x_* w2x_*

spregxt y x1 x2 , nc(7) model(gs2sls) wmfile(SPWxt) order(2) stand list
list w1y_* w1x_* w2x_*

spregxt y x1 x2 , nc(7) model(gs2sls) wmfile(SPWxt) order(3) list
list w1y_* w1x_* w2x_* w3x_*

spregxt y x1 x2 , nc(7) model(gs2sls) wmfile(SPWxt) order(3) stand list
list w1y_* w1x_* w2x_* w3x_*

spregxt y x1 x2 , nc(7) model(gs2sls) wmfile(SPWxt) order(4) list
list w1y_* w1x_* w2x_* w3x_* w4x_*

spregxt y x1 x2 , nc(7) model(gs2sls) wmfile(SPWxt) order(4) stand list
list w1y_* w1x_* w2x_* w3x_* w4x_*

* (21) Create Panel Data Dummy Variables:
spregxt y x1 x2, nc(7) dumcs(Dum_cs)
spregxt y x1 x2, nc(7) dumts(Dum_ts)
spregxt y x1 x2, nc(7) dumcs(Dum_cs) dumts(Dum_ts)

* (5) Spatial Panel Autoregressive Generalized Method of Moments (Cont.)
This example is taken from Prucha data about Spatial Panel Regression.
More details can be found in:
http://econweb.umd.edu/~prucha/Research_Prog3.htm
Results of model(spgmm) with gmm(3) option is identical to:
http://econweb.umd.edu/~prucha/STATPROG/PANOLS/PROGRAM3(L3).log

clear all
sysuse spregxt1.dta, clear
spregxt y x1 , wmfile(SPWxt1) nc(100) model(spgmm) gmm(1) stand
spregxt y x1 , wmfile(SPWxt1) nc(100) model(spgmm) gmm(2) stand
spregxt y x1 , wmfile(SPWxt1) nc(100) model(spgmm) gmm(3) stand

clear all
sysuse spregxt.dta, clear
spregxt y x1 x2 , nc(7) wmfile(SPWxt) model(sar) mfx(lin) pmfx tests predict(Yh) resid(Ue)

==============================================================================
*** Binary (0/1) Weight Matrix: (49x49) : NC=7 NT=7 (Non Normalized)
------------------------------------------------------------------------------
==============================================================================
* MLE Spatial Panel Lag Normal Model (SAR)
==============================================================================
y = w1y_y x1 x2
------------------------------------------------------------------------------
Sample Size = 49 | Cross Sections Number = 7
Wald Test = 54.7117 | P-Value > Chi2(2) = 0.0000
F-Test = 27.3558 | P-Value > F(2 , 40) = 0.0000
R2 (R-Squared) = 0.5433 | Raw Moments R2 = 0.9169
R2a (Adjusted R2) = 0.4519 | Raw Moments R2 Adj = 0.9003
Root MSE (Sigma) = 12.3874 | Log Likelihood Function = -187.2901
------------------------------------------------------------------------------
- R2h= 0.5524 R2h Adj= 0.4628 F-Test = 28.38 P-Value > F(2 , 40) 0.0000
- R2r= 0.9169 R2r Adj= 0.9003 F-Test = 169.29 P-Value > F(3 , 40) 0.0000
------------------------------------------------------------------------------
y | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
y |
x1 | -.2640053 .1025716 -2.57 0.010 -.4650418 -.0629687
x2 | -1.599966 .3231151 -4.95 0.000 -2.23326 -.9666723
_cons | 69.85042 5.446557 12.82 0.000 59.17537 80.52548
-------------+----------------------------------------------------------------
Rho | -.0157471 .037723 -0.42 0.676 -.0896829 .0581887
Sigma | 11.05584 1.11696 9.90 0.000 8.866635 13.24504
------------------------------------------------------------------------------
LR Test SAR vs. OLS (Rho=0): 0.1743 P-Value > Chi2(1) 0.6764
Acceptable Range for Rho: -0.5201 < Rho < 0.3115
------------------------------------------------------------------------------

==============================================================================
* Panel Model Selection Diagnostic Criteria - Model= (sar)
==============================================================================
- Log Likelihood Function LLF = -187.2901
---------------------------------------------------------------------------
- Akaike Information Criterion (1974) AIC = 141.5802
- Akaike Information Criterion (1973) Log AIC = 4.9529
---------------------------------------------------------------------------
- Schwarz Criterion (1978) SC = 158.9663
- Schwarz Criterion (1978) Log SC = 5.0687
---------------------------------------------------------------------------
- Amemiya Prediction Criterion (1969) FPE = 162.8422
- Hannan-Quinn Criterion (1979) HQ = 147.9405
- Rice Criterion (1984) Rice = 142.7418
- Shibata Criterion (1981) Shibata = 140.6016
- Craven-Wahba Generalized Cross Validation (1979) GCV = 142.1347
------------------------------------------------------------------------------

==============================================================================
*** Spatial Panel Aautocorrelation Tests - Model= (sar)
*** Binary (0/1) Weight Matrix (W): (Non Normalized)
==============================================================================
Ho: Error has No Spatial AutoCorrelation
Ha: Error has Spatial AutoCorrelation

- GLOBAL Moran MI = -0.0792 P-Value > Z(-0.512) 0.6086
- GLOBAL Geary GC = 1.0330 P-Value > Z(0.235) 0.8140
- GLOBAL Getis-Ords GO = 0.2262 P-Value > Z(0.512) 0.6086
------------------------------------------------------------------------------
- Moran MI Error Test = -0.0434 P-Value > Z(-0.198) 0.9654
------------------------------------------------------------------------------
- LM Error (Burridge) = 0.3866 P-Value > Chi2(1) 0.5341
- LM Error (Robust) = 0.2527 P-Value > Chi2(1) 0.6152
------------------------------------------------------------------------------
Ho: Spatial Lagged Dependent Variable has No Spatial AutoCorrelation
Ha: Spatial Lagged Dependent Variable has Spatial AutoCorrelation

- LM Lag (Anselin) = 0.1340 P-Value > Chi2(1) 0.7144
- LM Lag (Robust) = 0.0000 P-Value > Chi2(1) 0.9991
------------------------------------------------------------------------------
Ho: No General Spatial AutoCorrelation
Ha: General Spatial AutoCorrelation

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

==============================================================================
*** Panel Unit Roots Tests - Model= (sar)
==============================================================================
Ho: All Panels are Stationary - Ha: Some Panels Have Unit Roots

- Hadri Z Test (No Trend - No Robust) = 1.9540 P-Value > Z(0,1) 0.0254
- Hadri Z Test (No Trend - Robust) = 2.0098 P-Value > Z(0,1) 0.0222
- Hadri Z Test ( Trend - No Robust) = 0.9539 P-Value > Z(0,1) 0.1701
- Hadri Z Test ( Trend - Robust) = 0.6572 P-Value > Z(0,1) 0.2555
------------------------------------------------------------------------------
==============================================================================
* (1) (DF): Dickey-Fuller Test
* (2) (ADF): Augmented Dickey-Fuller Test
* (3) (APP): Augmented Phillips-Perron Test
--------------------------------------------------
Ho: All Panels Have Unit Roots (Non stationary)
Ha: At Least One Panel is Stationary
------------------------------------------------------------------------------
Ho: Non Stationary [0.05, 0.01 < P-Value]
Ha: Stationary [0.05, 0.01 > P-Value]
------------------------------------------------------------------------------
*** (1) Dickey-Fuller (DF) Test:
--------------------------------------------------
- DF Test: [Lag = 0] (No Trend) = -2.1511 P-Value > Z(0,1) 0.0157
* Since [.05 > 0.0157]: Variable (y) has Stationary Process
------------------------------------------------------------------------------
- DF Test: [Lag = 0] ( Trend) = -1.7131 P-Value > Z(0,1) 0.0433
* Since [.05 > 0.0433]: Variable (y) has Stationary Process
------------------------------------------------------------------------------

------------------------------------------------------------------------------
*** (2) Augmented Dickey-Fuller (ADF) Test:
--------------------------------------------------
- ADF Test: [Lag = 1] (No Trend) = 0.6539 P-Value > Z(0,1) 0.7434
* Since [.05 < 0.7434]: Variable (y) has Non Stationary (Unit Roots)
------------------------------------------------------------------------------
- ADF Test: [Lag = 1] ( Trend) = -3.8085 P-Value > Z(0,1) 0.0001
* Since [.05 > 0.0001]: Variable (y) has Stationary Process
------------------------------------------------------------------------------

------------------------------------------------------------------------------
*** (3) Augmented Phillips-Perron (APP) Test:
--------------------------------------------------
- APP Test: [Lag = 1] (No Trend) = -2.8930 P-Value > Z(0,1) 0.0019
* Since [.05 > 0.0019]: Variable (y) has Stationary Process
------------------------------------------------------------------------------
- APP Test: [Lag = 1] ( Trend) = -4.5522 P-Value > Z(0,1) 0.0000
* Since [.05 > 0.0000]: Variable (y) has Stationary Process
------------------------------------------------------------------------------

==============================================================================
*** Panel Error Component Tests - Model= (sar)
==============================================================================
* Panel Random Effects Tests
Ho: Fixed Effects Model (FEM) - Ha: Random Effects Model (REM)
Ho: No AR(1) Autocorrelation - Ha: AR(1) Autocorrelation

- Breusch-Pagan LM Test -Two Side = 20.5375 P-Value > Chi2(1) 0.0000
- Breusch-Pagan ALM Test -Two Side = 10.7351 P-Value > Chi2(1) 0.0011
------------------------------------------------------------------------------
- Sosa-Escudero-Yoon LM Test -One Side = 4.5318 P-Value > Chi2(1) 0.0333
- Sosa-Escudero-Yoon ALM Test -One Side = 3.2764 P-Value > Chi2(1) 0.0703
------------------------------------------------------------------------------
- Baltagi-Li LM Autocorrelation Test = 10.8752 P-Value > Chi2(1) 0.0010
- Baltagi-Li ALM Autocorrelation Test = 1.0729 P-Value > Chi2(1) 0.3003
------------------------------------------------------------------------------
- Baltagi-Li LM AR(1) Joint Test = 21.6103 P-Value > Chi2(2) 0.0000
------------------------------------------------------------------------------

* Contemporaneous Correlations Across Cross Sctions Test
Ho: No Contemporaneous Correlations (Independence) - (OLS)
Ha: Contemporaneous Correlations (Dependence) - (Panel)

- Breusch-Pagan Diagonal Covariance Matrix LM Test= 32.3077 P>Chi2(21) 0.0545
- Breusch-Pagan Cross-Section Independence LM Test= 26.4443 P>Chi2(21) 0.1900
------------------------------------------------------------------------------
LM= Lagrange Multiplier ; ALM = Adjusted Lagrange Multiplier
------------------------------------------------------------------------------

==============================================================================
*** Panel Serial Autocorrelation Tests - Model= (sar)
==============================================================================
Ho: No AR(1) Panel AutoCorrelation - Ha: AR(1) Panel AutoCorrelation

- Durbin h Test (Lag DepVar) = 4.1606 P-Value > Z(0,1) 0.0000
- Harvey LM Test (Lag DepVar) = 17.3105 P-Value > Chi2(1) 0.0000
------------------------------------------------------------------------------
- Panel Rho Value = 0.4330
- Durbin-Watson Test = 1.0273 df: (3 , 49)
- Von Neumann Ratio Test = 1.0487 df: (3 , 49)
- Box-Pierce LM Test = 9.1884 P-Value > Chi2(1) 0.0024
- Z Test = 3.0312 P-Value > Z(0,1) 0.0024
------------------------------------------------------------------------------
- Durbin m Test (drop 1 cs obs) = 10.7685 P-Value > F(1,38) 0.0022
- Durbin m Test (keep 1 cs obs) = 11.9227 P-Value > F(1,45) 0.0012
------------------------------------------------------------------------------
- Breusch-Godfrey LM Test (drop 1 cs obs) = 9.3076 P-Value > Chi2(1) 0.0023
- Breusch-Godfrey LM Test (keep 1 cs obs) = 10.2638 P-Value > Chi2(1) 0.0014
------------------------------------------------------------------------------
- Breusch-Pagan-Godfrey Z (keep 1 nt obs) = 2.9534 P-Value > Z(0,1) 0.0031
- Breusch-Pagan-Godfrey Z (drop 1 cs obs) = 3.0508 P-Value > Z(0,1) 0.0023
- Breusch-Pagan-Godfrey Z (keep 1 cs obs) = 3.2037 P-Value > Z(0,1) 0.0014
------------------------------------------------------------------------------
- Baltagi LM Test = 10.7198 P-Value > Chi2(1) 0.0011
- Baltagi Z Test = 3.2741 P-Value > Z(0,1) 0.0011
------------------------------------------------------------------------------
- Wooldridge F Test = 8.6440 P-Value > F(1, 6) 0.0259
- Wooldridge LM Test = 7.0879 P-Value > Chi2(1) 0.0078
------------------------------------------------------------------------------

==============================================================================
*** Panel Heteroscedasticity Tests - Model= (sar)
==============================================================================
Ho: Panel Homoscedasticity - Ha: Panel Heteroscedasticity

- Engle LM ARCH Test AR(1): E2 = E2_1 = 0.5087 P-Value > Chi2(1) 0.4757
------------------------------------------------------------------------------
- Hall-Pagan LM Test: E2 = Yh = 0.7757 P-Value > Chi2(1) 0.3785
- Hall-Pagan LM Test: E2 = Yh2 = 0.4797 P-Value > Chi2(1) 0.4886
- Hall-Pagan LM Test: E2 = LYh2 = 0.7284 P-Value > Chi2(1) 0.3934
------------------------------------------------------------------------------
- Harvey LM Test: LogE2 = X = 5.4808 P-Value > Chi2(2) 0.0645
- Wald Test: LogE2 = X = 13.5232 P-Value > Chi2(1) 0.0002
- Glejser LM Test: |E| = X = 6.7198 P-Value > Chi2(2) 0.0347
- Breusch-Godfrey Test: E = E_1 X = 8.1291 P-Value > Chi2(1) 0.0044
------------------------------------------------------------------------------
- Machado-Santos-Silva Test: Ev=Yh Yh2 = 2.7411 P-Value > Chi2(2) 0.2540
- Machado-Santos-Silva Test: Ev=X = 6.8996 P-Value > Chi2(2) 0.0318
------------------------------------------------------------------------------
- White Test - Koenker(R2): E2 = X = 7.0554 P-Value > Chi2(2) 0.0294
- White Test - B-P-G (SSR): E2 = X = 9.2158 P-Value > Chi2(2) 0.0100
------------------------------------------------------------------------------
- White Test - Koenker(R2): E2 = X X2 = 7.6860 P-Value > Chi2(4) 0.1038
- White Test - B-P-G (SSR): E2 = X X2 = 10.0396 P-Value > Chi2(4) 0.0398
------------------------------------------------------------------------------
- White Test - Koenker(R2): E2 = X X2 XX= 19.7124 P-Value > Chi2(5) 0.0014
- White Test - B-P-G (SSR): E2 = X X2 XX= 25.7486 P-Value > Chi2(5) 0.0001
------------------------------------------------------------------------------
- Cook-Weisberg LM Test: E2/S2n = Yh = 1.0132 P-Value > Chi2(1) 0.3141
- Cook-Weisberg LM Test: E2/S2n = X = 9.2158 P-Value > Chi2(2) 0.0100
------------------------------------------------------------------------------
*** Single Variable Tests (E2/Sig2):
- Cook-Weisberg LM Test: x1 = 1.0861 P-Value > Chi2(1) 0.2973
- Cook-Weisberg LM Test: x2 = 3.7967 P-Value > Chi2(1) 0.0514
------------------------------------------------------------------------------
*** Single Variable Tests:
- King LM Test: x1 = 0.1519 P-Value > Chi2(1) 0.6968
- King LM Test: x2 = 4.2287 P-Value > Chi2(1) 0.0397
------------------------------------------------------------------------------

==============================================================================
* Panel Groupwise Heteroscedasticity Tests
==============================================================================
Ho: Panel Homoscedasticity - Ha: Panel Groupwise Heteroscedasticity

- Lagrange Multiplier LM Test = 7.3373 P-Value > Chi2(6) 0.2908
- Likelihood Ratio LR Test = 7.1253 P-Value > Chi2(6) 0.3094
- Wald Test = 12.4812 P-Value > Chi2(7) 0.0858
------------------------------------------------------------------------------

==============================================================================
* Panel Non Normality Tests - Model= (sar)
==============================================================================
Ho: Normality - Ha: Non Normality
------------------------------------------------------------------------------
*** Non Normality Tests:
- Jarque-Bera LM Test = 1.6062 P-Value > Chi2(2) 0.4479
- White IM Test = 5.8155 P-Value > Chi2(2) 0.0546
- Doornik-Hansen LM Test = 3.5054 P-Value > Chi2(2) 0.1733
- Geary LM Test = -2.7412 P-Value > Chi2(2) 0.2540
- Anderson-Darling Z Test = 0.3237 P > Z( 0.118) 0.5472
- D'Agostino-Pearson LM Test = 2.5494 P-Value > Chi2(2) 0.2795
------------------------------------------------------------------------------
*** Skewness Tests:
- Srivastava LM Skewness Test = 0.6074 P-Value > Chi2(1) 0.4358
- Small LM Skewness Test = 0.7396 P-Value > Chi2(1) 0.3898
- Skewness Z Test = -0.8600 P-Value > Chi2(1) 0.3898
------------------------------------------------------------------------------
*** Kurtosis Tests:
- Srivastava Z Kurtosis Test = 0.9994 P-Value > Z(0,1) 0.3176
- Small LM Kurtosis Test = 1.8098 P-Value > Chi2(1) 0.1785
- Kurtosis Z Test = 1.3453 P-Value > Chi2(1) 0.1785
------------------------------------------------------------------------------
Skewness Coefficient = -0.2727 - Standard Deviation = 0.3398
Kurtosis Coefficient = 3.6994 - Standard Deviation = 0.6681
------------------------------------------------------------------------------
Runs Test: (16) Runs - (24) Positives - (25) Negatives
Standard Deviation Runs Sig(k) = 3.4619 , Mean Runs E(k) = 25.4898
95% Conf. Interval [E(k)+/- 1.96* Sig(k)] = (18.7045 , 32.2751 )
------------------------------------------------------------------------------

==============================================================================
*** 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 = 2.723 P-Value > F(1, 45) 0.1059
- Ramsey RESETF2 Test: Y= X Yh2 Yh3 = 1.344 P-Value > F(2, 44) 0.2713
- Ramsey RESETF3 Test: Y= X Yh2 Yh3 Yh4 = 1.922 P-Value > F(3, 43) 0.1402
------------------------------------------------------------------------------
* DeBenedictis-Giles Specification ResetL Test
- Debenedictis-Giles ResetL1 Test = 1.585 P-Value > F(2, 44) 0.2164
- Debenedictis-Giles ResetL2 Test = 1.244 P-Value > F(4, 42) 0.3073
- Debenedictis-Giles ResetL3 Test = 1.273 P-Value > F(6, 40) 0.2915
------------------------------------------------------------------------------
* DeBenedictis-Giles Specification ResetS Test
- Debenedictis-Giles ResetS1 Test = 1.754 P-Value > F(2, 44) 0.1850
- Debenedictis-Giles ResetS2 Test = 2.189 P-Value > F(4, 42) 0.0867
- Debenedictis-Giles ResetS3 Test = 1.416 P-Value > F(6, 40) 0.2323
------------------------------------------------------------------------------

==============================================================================
*** Multicollinearity Diagnostic Tests - Model= (sar)
==============================================================================

* Correlation Matrix
+------------------------------------------+
| Variable | y | x1 | x2 |
|------------+---------+---------+---------|
| y | 1.000 | | |
| x1 | -0.574 | 1.000 | |
| x2 | -0.696 | 0.500 | 1.000 |
+------------------------------------------+

| y x1 x2
-------------+---------------------------
y | 1.0000
|
|
x1 | -0.5745* 1.0000
| 0.0000
|
x2 | -0.6956* 0.4999* 1.0000
| 0.0000 0.0003
|

* Multicollinearity Diagnostic Criteria
+----------------------------------------------------------------------------+
| Variable | Eigenval | C_Number | C_Index | VIF | 1/VIF | R2_xi,X |
|----------+----------+----------+----------+----------+----------+----------|
| x1 | 1.4999 | 1.0000 | 1.0000 | 1.3331 | 0.7501 | 0.2499 |
| x2 | 0.5001 | 2.9990 | 1.7318 | 1.3331 | 0.7501 | 0.2499 |
+----------------------------------------------------------------------------+

* Farrar-Glauber Multicollinearity Tests
Ho: No Multicollinearity - Ha: Multicollinearity
--------------------------------------------------

* (1) Farrar-Glauber Multicollinearity Chi2-Test:
Chi2 Test = 13.3697 P-Value > Chi2(1) 0.0003

* (2) Farrar-Glauber Multicollinearity F-Test:
+------------------------------------------------------------------------+
| Variable | F_Test | DF1 | DF2 | P_Value |
|------------+--------------+--------------+--------------+--------------|
| x1 | 15.657 | 47.000 | 2.000 | 0.062 |
| x2 | 15.657 | 47.000 | 2.000 | 0.062 |
+------------------------------------------------------------------------+

* (3) Farrar-Glauber Multicollinearity t-Test:
+------------------------------------+
| Variable | x1 | x2 |
|------------+-----------+-----------|
| x1 | . | |
|------------+-----------+-----------|
| x2 | 3.957 | . |
+------------------------------------+

* |X'X| Determinant:
|X'X| = 0 Multicollinearity - |X'X| = 1 No Multicollinearity
|X'X| Determinant: (0 < 0.7501 < 1)
---------------------------------------------------------------

* Theil R2 Multicollinearity Effect:
R2 = 0 No Multicollinearity - R2 = 1 Multicollinearity
- Theil R2: (0 < 0.2706 < 1)
---------------------------------------------------------------

* Multicollinearity Range:
Q = 0 No Multicollinearity - Q = 1 Multicollinearity
- Gleason-Staelin Q0: (0 < 0.4999 < 1)
1- Heo Range Q1: (0 < 0.1974 < 1)
2- Heo Range Q2: (0 < 0.2499 < 1)
3- Heo Range Q3: (0 < 0.1339 < 1)
4- Heo Range Q4: (0 < 0.6494 < 1)
5- Heo Range Q5: (0 < 0.2372 < 1)
6- Heo Range Q6: (0 < 0.2499 < 1)
------------------------------------------------------------------------------

==============================================================================
*** Linear vs Log-Linear Functional Form Tests - (Model= OLS)
==============================================================================
(1) R-squared
Linear R2 = 0.5524
Log-Log R2 = 0.3749
---------------------------------------------------------------------------
(2) Log Likelihood Function (LLF)
LLF - Linear = -187.3772
LLF - Log-Log = -224.3892
---------------------------------------------------------------------------
(3) Antilog R2
Linear vs Log-Log: R2Lin = 0.5269
Log-Log vs Linear : R2log = 0.1208
---------------------------------------------------------------------------
(4) Box-Cox Test = 36.2567 P-Value > Chi2(1) 0.0000
Ho: Choose Log-Log Model - Ha: Choose Linear Model
---------------------------------------------------------------------------
(5) Bera-McAleer BM Test
Ho: Choose Linear Model = 2.3994 P-Value > F(1, 44) 0.1285
Ho: Choose Log-Log Model = 0.8078 P-Value > F(1, 45) 0.3736
---------------------------------------------------------------------------
(6) Davidson-Mackinnon PE Test
Ho: Choose Linear Model = 2.3994 P-Value > F(1, 44) 0.1285
Ho: Choose Log-Log Model = 0.8078 P-Value > F(1, 45) 0.3736
------------------------------------------------------------------------------

==============================================================================

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

+-------------------------------------------------------------------------------+
| Variable | Beta(B) | Total | Direct | InDirect | Mean |
|--------------+------------+------------+------------+------------+------------|
|y | | | | | |
| x1 | -0.2640 | -0.2638 | -0.2758 | 0.0120 | 38.4362 |
| x2 | -1.6000 | -1.5989 | -1.6716 | 0.0727 | 14.3749 |
+-------------------------------------------------------------------------------+

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

+-------------------------------------------------------------------------------+
| Variable | Beta(Es) | Total | Direct | InDirect | Mean |
|--------------+------------+------------+------------+------------+------------|
| x1 | -0.2889 | -0.2887 | -0.3018 | 0.0131 | 38.4362 |
| x2 | -0.6547 | -0.6543 | -0.6840 | 0.0298 | 14.3749 |
+-------------------------------------------------------------------------------+
Mean of Dependent Variable = 35.1288

------------------------------------------------------------------------------
*** P-Value: Total, Direct, and InDirect Marginal Effect ***
------------------------------------------------------------------------------

*** (1) Total Marginal Effect ***
------------------------------------------------------------------------------
Total | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
y |
x1 | -.2638216 .1025716 -2.57 0.014 -.4711265 -.0565168
x2 | -1.598853 .3231151 -4.95 0.000 -2.251893 -.9458132
------------------------------------------------------------------------------

*** (2) Direct Marginal Effect ***
------------------------------------------------------------------------------
Direct | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
y |
x1 | -.2758194 .1025716 -2.69 0.010 -.4831243 -.0685146
x2 | -1.671564 .3231151 -5.17 0.000 -2.324604 -1.018524
------------------------------------------------------------------------------

*** (3) InDirect Marginal Effect ***
------------------------------------------------------------------------------
InDirect | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
y |
x1 | .0119978 .1025716 0.12 0.907 -.1953071 .2193026
x2 | .0727109 .3231151 0.23 0.823 -.5803291 .7257508
------------------------------------------------------------------------------

Acknowledgments

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

- Mudit Kapoor, Harry H. Kelejian and Ingmar R. Prucha.
- Christopher F Baum for xttest2.
- Markus Eberhardt for xtmg.
- Walter Sosa Escudero & Anil Bera xttest1.

Author

Emad Abd Elmessih Shehata
Professor (PhD Economics)
Agricultural Research Center - Agricultural Economics Research Institute - Egypt
Email: emadstat@hotmail.com
IDEAS: http://ideas.repec.org/f/psh494.html
EconPapers: http://econpapers.repec.org/RAS/psh494.htm
Google Scholar: http://scholar.google.com/citations?hl=en&user=cOXvc94AAAAJ

SPREGXT Citation

Shehata, Emad Abd Elmessih (2016)

SPREGXT: "Stata Module Econometric Toolkit to Estimate Spatial Panel Regression Models"

Online Help:

*** Spatial Econometrics Regression Models:

--------------------------------------------------------------------------------
*** (1) Spatial Panel Data Regression Models:
spregxt Spatial Panel Regression Models: Econometric 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 Regression
spmstarxt (m-STAR) Spatial Lag Panel Models
spmstardxt (m-STAR) Spatial Durbin Panel Models
spmstardhxt (m-STAR) Spatial Durbin Multiplicative Heteroscedasticity Panel Models
spmstarhxt (m-STAR) Spatial Lag Multiplicative Heteroscedasticity Panel Models
spregdhp Spatial Panel Han-Philips Linear Dynamic Regression: Lag & Durbin Models
spregdpd Spatial Panel Arellano-Bond Linear Dynamic Regression: Lag & Durbin 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 Models: Econometric 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 Sections Models
spmstarh (m-STAR) Spatial Lag Multiplicative Heteroscedasticity Cross Sections 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
sptobitmstarxt Tobit (m-STAR) Spatial Lag Panel Models
sptobitmstardxt Tobit (m-STAR) Spatial Durbin Panel Models
sptobitmstardhxt Tobit (m-STAR) Spatial Durbin Multiplicative Heteroscedasticity Panel Models
sptobitmstarhxt Tobit (m-STAR) Spatial Lag Multiplicative Heteroscedasticity Panel 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
sptobitmstard Tobit (m-STAR) Spatial Durbin Cross Sections Models
sptobitmstardh Tobit (m-STAR) Spatial Durbin Multiplicative Heteroscedasticity Cross Sections
sptobitmstarh Tobit (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
--------------------------------------------------------------------------------