spxtregress can fits two different static spatial-panel-data autoregression models with fixed effects estimator (fe) or random effects estimator (re).
$$ \begin{align} y_{nt} &= \lambda W y_{nt} + X_{nt} \beta + \sum_{k=1}^K W_k X_{nt}\gamma_k + {\color{red}{c_n}} + u_{nt} \nonumber \\ u_{nt} &= \rho M u_{nt} + \epsilon_{nt} \label{eq:model_i} \end{align} $$
$$ \begin{align} y_{nt} &= \lambda W y_{nt} + X_{nt} \beta + \sum_{k=1}^K W_k X_{nt}\gamma_k + u_{nt} \nonumber \\ u_{nt} &= \rho M u_{nt} + {\color{red}{c_n}} + \epsilon_{nt} \label{eq:model_ii} \end{align} $$
Comments
We write Model I and II by explicitly writing out the spatial error terms.
$$ \begin{align*} y_{nt} &= \lambda W y_{nt} + X_{nt} \beta + \sum_{k=1}^K W_k X_{nt}\gamma_k + {\color{red}{c_n}} + (I - \rho M)^{-1}\epsilon_{nt} \\ y_{nt} &= \lambda W y_{nt} + X_{nt} \beta + \sum_{k=1}^K W_k X_{nt}\gamma_k + {\color{red}(I-\rho M)^{-1}c_n} +(I - \rho M)^{-1}\epsilon_{nt} \end{align*} $$
We can just regard ${\color{red}(I-\rho M)^{-1}c_n}$ as another form of fixed effect.
The spxtregress, fe use a within-type transformations (Helmert transformation) to remove the fixed effects $c_n$. However, this transformation also removes all the time invariate terms. So FE cannot estimate a time invariate term.
. spxtregress hrate gini i.year, fe dvarlag(W) errorlag(W)
(1016 observations)
(1016 observations used)
(data contain 254 panels (places) )
(weighting matrix defines 254 places)
Performing grid search ... finished
Optimizing concentrated log likelihood:
Iteration 0: log likelihood = -2569.5658
Iteration 1: log likelihood = -2569.3675
Iteration 2: log likelihood = -2569.3668
Iteration 3: log likelihood = -2569.3668
Optimizing unconcentrated log likelihood:
Iteration 0: log likelihood = -2576.1229
Iteration 1: log likelihood = -2574.3725
Iteration 2: log likelihood = -2574.3683
Iteration 3: log likelihood = -2574.3683
Fixed-effects spatial regression Number of obs = 1,016
Group variable: _ID Number of groups = 254
Obs per group = 4
Wald chi2(2) = 78.53
Prob > chi2 = 0.0000
Log likelihood = -2574.3683 Pseudo R2 = 0.0017
------------------------------------------------------------------------------
hrate | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
hrate |
gini | 34.71117 9.312023 3.73 0.000 16.45994 52.9624
|
year |
1970 | 0 (omitted)
1980 | 0 (omitted)
1990 | 0 (omitted)
-------------+----------------------------------------------------------------
W |
hrate | -.8918254 .1171214 -7.61 0.000 -1.121379 -.6622718
e.hrate | .7645118 .0574604 13.31 0.000 .6518915 .8771321
-------------+----------------------------------------------------------------
/sigma_e | 6.414088 .2154119 6.005484 6.850493
------------------------------------------------------------------------------
Wald test of spatial terms: chi2(2) = 197.10 Prob > chi2 = 0.0000
. estat impact
progress :100%
Average impacts Number of obs = 1,016
------------------------------------------------------------------------------
| Delta-Method
| dy/dx Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
direct |
gini | 38.06052 10.15738 3.75 0.000 18.15242 57.96863
-------------+----------------------------------------------------------------
indirect |
gini | -18.15548 5.067272 -3.58 0.000 -28.08715 -8.223809
-------------+----------------------------------------------------------------
total |
gini | 19.90504 5.550587 3.59 0.000 9.026093 30.784
------------------------------------------------------------------------------
Note that the variable year is omitted in the estat impact.
$$ \begin{align*} y_{nt} &= \lambda W y_{nt} + X_{nt} \beta + \sum_{k=1}^K W_k X_{nt}\gamma_k + {\color{red}(I-\rho M)^{-1}c_n} +{\color{blue}(I - \rho M)^{-1}\epsilon_{nt}} \end{align*} $$
. qui spxtregress hrate gini i.year, re dvarlag(W)
. estimate store model_1
. qui spxtregress hrate gini i.year, re dvarlag(W) sarpanel
. estimate store model_2
. estimate table model_1 model_2
----------------------------------------
Variable | model_1 model_2
-------------+--------------------------
hrate |
gini | 4.3603851 4.3603851
|
year |
1970 | 2.230819 2.230819
1980 | 2.729887 2.729887
1990 | 1.9152529 1.9152529
|
_cons | 3.186456 3.186456
-------------+--------------------------
W |
hrate | .20003314 .20003314
-------------+--------------------------
sigma_u |
_cons | 2.625071 2.625071
-------------+--------------------------
sigma_e |
_cons | 7.1365439 7.1365439
----------------------------------------
. qui spxtregress hrate gini, re dvarlag(W)
. estat impact
progress :100%
Average impacts Number of obs = 1,016
------------------------------------------------------------------------------
| Delta-Method
| dy/dx Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
direct |
gini | 17.53096 5.208656 3.37 0.001 7.322179 27.73974
-------------+----------------------------------------------------------------
indirect |
gini | 4.508373 1.654764 2.72 0.006 1.265095 7.751652
-------------+----------------------------------------------------------------
total |
gini | 22.03933 6.513159 3.38 0.001 9.273774 34.80489
------------------------------------------------------------------------------
. estat impact if year == 1960
progress :100%
Average impacts Number of obs = 254
------------------------------------------------------------------------------
| Delta-Method
| dy/dx Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
direct |
gini | 17.53096 5.208656 3.37 0.001 7.322179 27.73974
-------------+----------------------------------------------------------------
indirect |
gini | 4.508373 1.654764 2.72 0.006 1.265095 7.751652
-------------+----------------------------------------------------------------
total |
gini | 22.03933 6.513159 3.38 0.001 9.273774 34.80489
------------------------------------------------------------------------------