```-------------------------------------------------------------------------------
help: spmstar                                                   dialog: spmstar
-------------------------------------------------------------------------------

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

spmstar: (m-STAR) Multiparametric Spatio Temporal AutoRegressive Regression
(Spatial Lag Cross Sections Models)

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

Syntax
Description
Options
Saved Results
References

*** Examples

Author

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

spmstar depvar indepvars [weight] , wmfile(weight_file) nwmat(#)
noconstant

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

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

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

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

spmstar estimates Spatial econometric regression (MSTAR) "Multiparametric
Spatio Temporal AutoRegressive Regression" for Spatial Lag Cross Sections
Models.

spmstar estimates Continuous and Truncated Dependent Variables models tobit.

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

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

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

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

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

+---------+
----+ 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 (Optional)

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

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

inv              Use Inverse Standardized Weight Matrix (1/W)

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

spmstar 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

tobit            Estimate model via Tobit regression

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(weib) can be used.

dist(norm) is the default distribution.

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

spmstar saves the following results in e():

Scalars

e(N)            number of observations
e(r2bu)         R-squared (Buse 1973)
e(r2raw)        Raw Moments R2
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(mfxlinb)      Beta, Total, Direct, and InDirect Marginal Effect (in Lin Fo
> rm)
e(mfxline)      Beta, Total, Direct, and InDirect Elasticity      (in Lin Fo
> rm)

e(mfxlogb)      Beta, Total, Direct, and InDirect Marginal Effect (in Log Fo
> rm)
e(mfxloge)      Beta, Total, Direct, and InDirect Elasticity      (in Log Fo
> rm)

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

clear all

sysuse spmstar.dta, clear

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

*** YOU MUST HAVE DIFFERENT Weighted Matrixes Files:

* (1) *** Normal Distribution
spmstar y x1 x2 , wmfile(SPWmcs1) nwmat(1) mfx(lin) dist(norm)
spmstar y x1 x2 , wmfile(SPWmcs2) nwmat(2) mfx(lin) dist(norm)
spmstar y x1 x2 , wmfile(SPWmcs3) nwmat(3) mfx(lin) dist(norm)
spmstar y x1 x2 , wmfile(SPWmcs4) nwmat(4) mfx(lin) dist(norm)
spmstar ys x1 x2, wmfile(SPWmcs4) nwmat(4) mfx(lin) dist(norm) tobit ll(0)
spmstar ys x1 x2, wmfile(SPWmcs4) nwmat(4) mfx(lin) dist(norm) tobit ll(3)
-------------------------------------------------------------------------------

* (2) *** Weibull Distribution
spmstar y x1 x2 , wmfile(SPWmcs1) nwmat(1) mfx(lin) dist(weib)
spmstar y x1 x2 , wmfile(SPWmcs2) nwmat(2) mfx(lin) dist(weib)
spmstar y x1 x2 , wmfile(SPWmcs3) nwmat(3) mfx(lin) dist(weib)
spmstar y x1 x2 , wmfile(SPWmcs4) nwmat(4) mfx(lin) dist(weib)
spmstar ys x1 x2, wmfile(SPWmcs4) nwmat(4) mfx(lin) dist(weib) tobit ll(0)
spmstar ys x1 x2, wmfile(SPWmcs4) nwmat(4) mfx(lin) dist(weib) tobit ll(3)
-------------------------------------------------------------------------------

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

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

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

==============================================================================
*** Binary (0/1) Weight Matrix: 49x49 (Non Normalized)
==============================================================================
==============================================================================
* MLE Multiparametric Spatio Temporal AutoRegressive Regression
* (m-STAR) Spatial Lag Normal Model (1 Weight Matrix)
==============================================================================
y = x1 + x2
------------------------------------------------------------------------------
Sample Size       =          49
Wald Test         =     56.4471   |   P-Value > Chi2(2)       =      0.0000
F-Test            =     28.2236   |   P-Value > F(2 , 47)     =      0.0000
(Buse 1973) R2     =      0.5510   |   Raw Moments R2          =      0.9184
(Buse 1973) R2 Adj =      0.5414   |   Raw Moments R2 Adj      =      0.9166
Root MSE (Sigma)  =     11.3305   |   Log Likelihood Function =   -186.8161
------------------------------------------------------------------------------
- R2h= 0.5510   R2h Adj= 0.5415  F-Test =   28.23 P-Value > F(2 , 47)  0.0000
- R2v= 0.5543   R2v Adj= 0.5448  F-Test =   28.61 P-Value > F(2 , 47)  0.0000
------------------------------------------------------------------------------
- Sum of Rho's =    0.0211161    Sum must be < 1 for Stability Condition
------------------------------------------------------------------------------
y |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
y            |
x1 |   -.252788   .1007052    -2.51   0.012    -.4501667   -.0554094
x2 |  -1.585978   .3198759    -4.96   0.000    -2.212924    -.959033
_cons |   64.04514   6.233457    10.27   0.000     51.82779    76.26249
-------------+----------------------------------------------------------------
Rho1 |   .0211161   .0197638     1.07   0.285    -.0176202    .0598524
Sigma |   10.94111    1.10546     9.90   0.000     8.774445    13.10777
------------------------------------------------------------------------------
Wald Test [Rho1=0]:                 1.1415        P-Value > Chi2(1) 0.2853
Acceptable Range for Rho1: -0.3199 < Rho1 < 0.1633
------------------------------------------------------------------------------

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

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

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

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

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

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

+------------------+
----+ SPMSTAR Citation +-------------------------------------------------

SPMSTAR: "(m-STAR) Spatial Multiparametric Spatio Temporal AutoRegressive
Regression: Spatial Lag Cross Sections Models"

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

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

*** Spatial Econometrics Regression Models:

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

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

```