```-------------------------------------------------------------------------------
help: spmstard                                                        dialog: s
> pmstard
-------------------------------------------------------------------------------

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

spmstard: (m-STAR) Multiparametric Spatio Temporal AutoRegressive Regression
(Spatial Durbin Cross Sections Models)

+-------------------+

Syntax
Description
Options
Saved Results
References

*** Examples

Authors

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

spmstard depvar indepvars [weight] , wmfile(weight_file) nwmat(#)
noconstant aux(varlist)

[ stand inv inv2 dist(norm|weib) mfx(lin, log) tolog nolog robust

predict(new_var) resid(new_var) iter(#) tech(name) coll zero ll(real
0)

level(#) vce(vcetype) maximize other maximization options ]

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

spmstard estimates Spatial econometric regression (MSTAR) "Multiparametric
Spatio Temporal AutoRegressive Regression" for Spatial Durbin Cross
Sections models.

spmstard estimates Continuous and Truncated Dependent Variables models tobit.

spmstard deals with data either continuous or truncated dependent variable.
If depvar has missing values or lower limits, so in this case spmstard will
fit spatial cross section model via tobit model, and thus spmstard 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.

spmstard can generate:
- Binary / Standardized Weight Matrix.
- Inverse  / Inverse Squared Standardized Weight Matrix.
- Binary / Standardized / Inverse Eigenvalues Variable.

spmstard predicted values 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).

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

wmfile(weight_file) Open CROSS SECTION weight matrix file.

Spatial Cross Sections Weight Matrix file must be:
1- Square Matrix [NxN]
2- Symmetric Matrix

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

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

inv              Use Inverse Standardized Weight Matrix (1/W)

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

spmstard is used with more than Weight Matrix: (Border, Language, Currency,

zero             convert missing values observations to Zero

nwmat(1, 2, 3, 4)number of Rho's matrixes to be used

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

noconstant       Exclude Constant Term from Equation

nolog            suppress iteration of the log likelihood

ll(#)            value of minimum left-censoring dependent variable with:
(tobit); default is 0

mfx(lin, log)    functional form: Linear model (lin), or Log-Log model (log),
to compute Total, Direct, and InDirect Marginal Effects and
> Elasticities
- In Linear model: marginal effects are the coefficients (Bm),
and elasticities are (Es = Bm X/Y).
- In Log-Log model: elasticities are the coefficients (Es),
and the marginal effects are (Bm = Es Y/X).
- mfx(log) and tolog options must be combined, to transform linear variables
>  to log form.

mfx(lin, log) 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

dist(norm, weib) Distribution of error term:
1- dist(norm) Normal distribution; default.
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) can be used.

dist(norm) is the default distribution.

aux(varlist) add Auxiliary Variables into regression model without
converting them to spatial lagged variables, i.e., dummy
variables.  This option dont include these auxiliary
variables among spatial lagged variables, it is useful in
(spmstard).  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.

predict(new_variable)      Predicted values variable

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

robust           Huber-White standard errors

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

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

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

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

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

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

spmstard saves the following results in e():

Scalars

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

Matrixes
e(b)            coefficient vector
e(V)            variance-covariance matrix of the estimators
e(mfx)          Beta, Total, Direct, and InDirect Marginal Effect
e(mfxe)         Beta, Total, Direct, and InDirect Elasticity

Functions
e(sample)       marks estimation sample

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

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

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.

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

clear all

sysuse spmstard.dta, clear

* (m-STAR) Multiparametric Spatio Temporal AutoRegressive Regression
* (m-STAR) Durbin Model

*** YOU MUST HAVE DIFFERENT Weighted Matrixes Files:

* (1) *** Normal Distribution
spmstard y x1 x2 , wmfile(SPWmcs1) nwmat(1) dist(norm)
spmstard y x1 x2 , wmfile(SPWmcs2) nwmat(2) dist(norm)
spmstard y x1 x2 , wmfile(SPWmcs3) nwmat(3) dist(norm)
spmstard y x1 x2 , wmfile(SPWmcs4) nwmat(4) dist(norm)

spmstard y x1 x2 , wmfile(SPWmcs4) nwmat(4) dist(norm) aux(x3 x4)

spmstard ys x1 x2, wmfile(SPWmcs4) nwmat(4) dist(norm) ll(0)
-------------------------------------------------------------------------------

* (2) *** Weibull Distribution
spmstard y x1 x2 , wmfile(SPWmcs1) nwmat(1) dist(weib)
spmstard y x1 x2 , wmfile(SPWmcs2) nwmat(2) dist(weib)
spmstard y x1 x2 , wmfile(SPWmcs3) nwmat(3) dist(weib)
spmstard y x1 x2 , wmfile(SPWmcs4) nwmat(4) dist(weib)

spmstard y x1 x2 , wmfile(SPWmcs4) nwmat(4) dist(weib) aux(x3 x4)

spmstard ys x1 x2, wmfile(SPWmcs4) nwmat(4) dist(weib) ll(0)
-------------------------------------------------------------------------------

* (3) Weighted mSTAR Normal Distribution:
spmstard y x1 x2 [pweight = x1], wmfile(SPWmcs1) nwmat(1) dist(norm)
spmstard y x1 x2 [aweight = x1], wmfile(SPWmcs1) nwmat(1) dist(norm)
spmstard y x1 x2 [iweight = x1], wmfile(SPWmcs1) nwmat(1) dist(norm)
-------------------------------------------------------------------------------

* (4) Weighted mSTAR Weibull Distribution:
spmstard y x1 x2 [pweight = x1], wmfile(SPWmcs1) nwmat(1) dist(weib)
spmstard y x1 x2 [aweight = x1], wmfile(SPWmcs1) nwmat(1) dist(weib)
spmstard y x1 x2 [iweight = x1], wmfile(SPWmcs1) nwmat(1) dist(weib)
-------------------------------------------------------------------------------

. clear all
. sysuse spmstard.dta, clear
. spmstard y x1 x2 , wmfile(SPWmcs1) nwmat(1) dist(norm) mfx(lin) stand

==============================================================================
*** Standardized Weight Matrix: 49x49 (Normalized)
==============================================================================

initial:       log likelihood = -184.03767
rescale:       log likelihood = -184.03767
rescale eq:    log likelihood = -184.03767
Iteration 0:   log likelihood = -184.03767
Iteration 1:   log likelihood = -183.30294
Iteration 2:   log likelihood =  -183.2614
Iteration 3:   log likelihood = -183.26127
Iteration 4:   log likelihood = -183.26127
==============================================================================
* MLE Multiparametric Spatio Temporal AutoRegressive Regression
* (m-STAR) Spatial Durbin Normal Model (1 Weight Matrix)
==============================================================================
y = x1 + x2 + w1x_x1 + w1x_x2
------------------------------------------------------------------------------
Sample Size       =          49
Wald Test         =     71.5437   |   P-Value > Chi2(4)       =      0.0000
F-Test            =     17.8859   |   P-Value > F(4 , 45)     =      0.0000
(Buse 1973) R2     =      0.6192   |   Raw Moments R2          =      0.9308
(Buse 1973) R2 Adj =      0.5938   |   Raw Moments R2 Adj      =      0.9261
Root MSE (Sigma)  =     10.6639   |   Log Likelihood Function =   -183.2613
------------------------------------------------------------------------------
- R2h= 0.6194   R2h Adj= 0.5940  F-Test =   17.90 P-Value > F(4 , 45)  0.0000
- R2v= 0.6016   R2v Adj= 0.5750  F-Test =   16.61 P-Value > F(4 , 45)  0.0000
------------------------------------------------------------------------------
- Sum of Rho's =    0.2162738    Sum must be < 1 for Stability Condition
------------------------------------------------------------------------------
y |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
y            |
x1 |  -.2601291   .0923128    -2.82   0.005    -.4410589   -.0791993
x2 |  -1.505436   .3025789    -4.98   0.000     -2.09848   -.9123926
w1x_x1 |  -.3976753   .2384109    -1.67   0.095    -.8649521    .0696015
w1x_x2 |   .6061678   .6380782     0.95   0.342    -.6444424    1.856778
_cons |   65.24606   17.63594     3.70   0.000     30.68025    99.81187
-------------+----------------------------------------------------------------
Rho1 |   .2162738   .1862329     1.16   0.246     -.148736    .5812836
Sigma |   10.13206   1.028118     9.85   0.000     8.116982    12.14713
------------------------------------------------------------------------------
Wald Test [Rho1=0]:                  1.3486        P-Value > Chi2(1) 0.2455
Acceptable Range for Rho1: -1.5345 < Rho1 < 1.0000
------------------------------------------------------------------------------

* Beta, Total, Direct, and InDirect Linear: Marginal Effect *

+--------------------------------------------------------------------------+
|     Variable |   Beta(B) |     Total |    Direct |  InDirect |      Mean |
|--------------+-----------+-----------+-----------+-----------+-----------|
|y             |           |           |           |           |           |
|           x1 |   -0.2601 |   -0.2573 |   -0.2039 |   -0.0534 |   38.4362 |
|           x2 |   -1.5054 |   -1.4888 |   -1.1798 |   -0.3090 |   14.3749 |
|       w1x_x1 |   -0.3977 |   -0.3933 |   -0.3117 |   -0.0816 |   37.2777 |
|       w1x_x2 |    0.6062 |    0.5995 |    0.4751 |    0.1244 |   14.0388 |
+--------------------------------------------------------------------------+

* Beta, Total, Direct, and InDirect Linear: Elasticity *

+--------------------------------------------------------------------------+
|     Variable |  Beta(Es) |     Total |    Direct |  InDirect |      Mean |
|--------------+-----------+-----------+-----------+-----------+-----------|
|           x1 |   -0.2846 |   -0.2815 |   -0.2231 |   -0.0584 |   38.4362 |
|           x2 |   -0.6160 |   -0.6092 |   -0.4828 |   -0.1264 |   14.3749 |
|       w1x_x1 |   -0.4220 |   -0.4173 |   -0.3307 |   -0.0866 |   37.2777 |
|       w1x_x2 |    0.2422 |    0.2396 |    0.1899 |    0.0497 |   14.0388 |
+--------------------------------------------------------------------------+
Mean of Dependent Variable =        35.1288

+---------+
----+ Authors +----------------------------------------------------------

- Emad Abd Elmessih Shehata
Professor (PhD Economics)
Agricultural Research Center - Agricultural Economics Research Institute - Eg
> ypt
WebPage at IDEAS:       http://ideas.repec.org/f/psh494.html
WebPage at EconPapers:  http://econpapers.repec.org/RAS/psh494.htm

- Sahra Khaleel A. Mickaiel
Professor (PhD Economics)
Cairo University - Faculty of Agriculture - Department of Economics - Egypt
Email:   sahra_atta@hotmail.com
WebPage:                http://sahraecon.110mb.com/stata.htm
WebPage at IDEAS:       http://ideas.repec.org/f/pmi520.html
WebPage at EconPapers:  http://econpapers.repec.org/RAS/pmi520.htm

+-------------------+
----+ spmstard Citation +------------------------------------------------

Shehata, Emad Abd Elmessih & Sahra Khaleel A. Mickaiel (2012)
SPMSTARD: "(m-STAR) Spatial Multiparametric Spatio Temporal AutoRegressive
Regression: Spatial Durbin Cross Sections Models"

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

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

(1) Spatial Econometrics Panel Data Regression Models:
gs2slsxt     Generalized Spatial Panel 2SLS Regression
gs2slsarxt   Generalized Spatial Panel Autoregressive 2SLS Regression
spglsxt      Spatial Panel Autoregressive Generalized Least Squares Regression
spgmmxt      Spatial Panel Autoregressive Generalized Method of Moments Regress
> ion
spmstarxt    (m-STAR) Spatial Multiparametric Spatio Temporal AutoRegressive Re
> gression:
Spatial Lag Panel Models
spmstardxt   (m-STAR) Spatial Multiparametric Spatio Temporal AutoRegressive Re
> gression:
Spatial Durbin Panel Models
spmstardhxt  (m-STAR) Spatial Multiparametric Spatio Temporal AutoRegressive Re
> gression:
Spatial Durbin Multiplicative Heteroscedasticity Panel Models
spmstarhxt   (m-STAR) Spatial Multiparametric Spatio Temporal AutoRegressive Re
> gression:
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 & Durbi
> n Models
spregfext    Spatial Panel Fixed Effects Regression: Lag & Durbin Models
spregrext    Spatial Panel Random Effects Regression: Lag & Durbin Models
spregsacxt   MLE Spatial AutoCorrelation Panel Regression (SAC)
spregsarxt   MLE Spatial Lag Panel Regression (SAR)
spregsdmxt   MLE Spatial Durbin Panel Regression (SDM)
spregsemxt   MLE Spatial Error Panel Regression (SEM)
spxttobit    Tobit Spatial Panel Autoregressive GLS Regression
spregxt      Spatial Panel Regression Econometric Models:
Complete Stata Module Software Toolkit

(2) Spatial Econometrics Cross Section Data Regression Models:
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
(Lag-Error-Durbin-SAC-SPGLS-GS2SLS-GS3SLS-SPML-SPGS-SPIVREG-IVTobi
> t)
spgmm        Spatial Autoregressive GMM Cross Sections Regression
spmstar      (m-STAR) Spatial Multiparametric Spatio Temporal AutoRegressive Re
> gression:
Spatial Lag Cross Sections Models
spmstard     (m-STAR) Spatial Multiparametric Spatio Temporal AutoRegressive Re
> gression:
Spatial Durbin Cross Sections Models
spmstardh    (m-STAR) Spatial Multiparametric Spatio Temporal AutoRegressive Re
> gression:
Spatial Durbin Multiplicative Heteroscedasticity Cross Sections Mo
> dels
spmstarh     (m-STAR) Spatial Multiparametric Spatio Temporal AutoRegressive Re
> gression:
Spatial Lag Multiplicative Heteroscedasticity Cross Sections Model
> s
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)
spregcs      Spatial Cross Section Regression Econometric Models:
Complete Stata Module Software Toolkit

(3) 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

```