Spatial Econometricswith Stata 2022
Spatial Econometricswith Stata 2022
Spatial Econometricswith Stata 2022
net/publication/358712548
CITATIONS READS
0 51
1 author:
SEE PROFILE
Some of the authors of this publication are also working on these related projects:
All content following this page was uploaded by Marcos Herrera Gomez on 18 February 2022.
Marcos Herrera-Gomez1
([email protected])
1 CONICET-IELDE
National University of Salta (Argentina)
General index
1 Overview
2 Exploratory Spatial Data Analysis
3 ESDA: Visualising spatial data
Loading data and choropleth maps
4 ESDA: Discovering patterns of spatial dependence
Matrices and spatial tests
Global Spatial Tests
Local Spatial Tests
Spatial Correlogram
5 Summary
Theory-driven
From individual decision to social-spatial interaction,
agent-based modelling.
Peer-effects, contextual effects, neighbourhood effects.
Data-driven
Geo-referenced information.
Technology
Geographical Information Systems.
Capability of statistical software.
locationally invariant
Overview
Exploratory Spatial Data Analysis
ESDA: Visualising spatial data
ESDA: Discovering patterns of spatial dependence
Summary
Elements of ESDA
General Index
1 Overview
2 Exploratory Spatial Data Analysis
3 ESDA: Visualising spatial data
Loading data and choropleth maps
4 ESDA: Discovering patterns of spatial dependence
Matrices and spatial tests
Global Spatial Tests
Local Spatial Tests
Spatial Correlogram
5 Summary
spshape2dta command
Syntax:
spshape2dta “shp.filename”, saving(filename) [options]
Example:
spshape2dta "Nuts2_epsg4326", saving(nuts2)
spshape2dta command
Syntax:
spshape2dta “shp.filename”, saving(filename) [options]
Example:
spshape2dta "Nuts2_epsg4326", saving(nuts2)
Visualizing in maps
A choropleth is a map in which each area is coloured with an
intensity proportional to the value of a quantitative variable. Some
classical maps:
Quantiles: class breaks correspond to quantiles of the distribution
of variable (each class includes approximately the same number of
polygons).
Equal Intervals: class breaks correspond to values that divide the
distribution of variable attribute into k equal-width intervals.
Boxplot: the distribution of variable attribute is divided into 6
classes defined as follows: [min, p25 − 1.5 ∗ iqr ],
(p25 − 1.5 ∗ iqr , p25], (p25, p50],(p50, p75], (p75, p75 + 1.5 ∗ iqr ]
and (p75 + 1.5 ∗ iqr , max], where iqr is the interquartile range.
Standard Deviates: the distribution of variable attribute is divided
into k classes (2 ≤ k ≤ 9) whose width is defined as a fraction p of
its standard deviation sd.
M. Herrera-Gomez Exploratory Spatial Data Analysis
Overview
Exploratory Spatial Data Analysis
ESDA: Visualising spatial data Loading data and choropleth maps
ESDA: Discovering patterns of spatial dependence
Summary
spmap command
Syntax:
spmap [attribute] [if] [in] using basemap [,basemap_options]
Details: basemap_options
polygon(polygon_suboptions)
line(line_suboptions)
point(point_suboptions)
diagram(diagram_suboptions)
arrow(arrow_suboptions)
label(label_suboptions)
scalebar(scalebar_suboptions)
graph_options]
spmap command
Syntax:
spmap [attribute] [if] [in] using basemap [,basemap_options]
Details: basemap_options
polygon(polygon_suboptions)
line(line_suboptions)
point(point_suboptions)
diagram(diagram_suboptions)
arrow(arrow_suboptions)
label(label_suboptions)
scalebar(scalebar_suboptions)
graph_options]
General Index
1 Overview
2 Exploratory Spatial Data Analysis
3 ESDA: Visualising spatial data
Loading data and choropleth maps
4 ESDA: Discovering patterns of spatial dependence
Matrices and spatial tests
Global Spatial Tests
Local Spatial Tests
Spatial Correlogram
5 Summary
Centrality of spatial W
Strategy of identification:
0 αij αik 0 wij wik
A = αji 0 αjk = ρ wji 0 wjk = ρW .
αki αkj 0 wki wkj 0
We transform a non-identified model in other that contains only one
parameter: ρ.
W captures ‘who is the neighbour of whom’: must be EXOGENOUS!
Advices about W
Griffith (1995):
“It is better to use a reasonable selection of the geographic
weight matrix that considers all null connections”.
“A relatively large number of regional units must be used in a
spatial statistical analysis.”
“Models with lower orders should be preferred over models
with higher orders”
“In general, it is better to use an under-identified weight matrix
than an over-identified one”.
• Exceptionally, it can be built from theory.
• It can be built based on non-geographical conditions: beware of
endogeneity!
• Generally, we work with row-normalized matrix.
General Index
1 Overview
2 Exploratory Spatial Data Analysis
3 ESDA: Visualising spatial data
Loading data and choropleth maps
4 ESDA: Discovering patterns of spatial dependence
Matrices and spatial tests
Global Spatial Tests
Local Spatial Tests
Spatial Correlogram
5 Summary
General Index
1 Overview
2 Exploratory Spatial Data Analysis
3 ESDA: Visualising spatial data
Loading data and choropleth maps
4 ESDA: Discovering patterns of spatial dependence
Matrices and spatial tests
Global Spatial Tests
Local Spatial Tests
Spatial Correlogram
5 Summary
General Index
1 Overview
2 Exploratory Spatial Data Analysis
3 ESDA: Visualising spatial data
Loading data and choropleth maps
4 ESDA: Discovering patterns of spatial dependence
Matrices and spatial tests
Global Spatial Tests
Local Spatial Tests
Spatial Correlogram
5 Summary
Summing up
Some references
Marcos Herrera-Gomez1
([email protected])
1 CONICET-IELDE
National University of Salta (Argentina)
General index
1 Introduction
2 Taxonomy of spatial models
3 Methods of estimation
Maximum likelihood estimation
Instrumental Variables and Generalized Method of Moments
4 Spatial Modelling: Data-driven strategies
Specific to General modelling
General to Specific modelling
5 Interpretation
Alternatives of specification
General Cliff-Ord model (Manski model)
y = ρWy + X β + WX θ + u,
u = λ Wu + ε.
General Index
1 Introduction
2 Taxonomy of spatial models
3 Methods of estimation
Maximum likelihood estimation
Instrumental Variables and Generalized Method of Moments
4 Spatial Modelling: Data-driven strategies
Specific to General modelling
General to Specific modelling
5 Interpretation
MLE
SARAR model
Assuming |ρ| < 1 and |λ | < 1, the log likelihood function is
n 1 1 0
L β , ρ, λ , σ 2 = − ln (π) − lnΩ + ln |I − ρW | + ln |I − λ W | − v v
2 2 2
0 0 0
with v v = (Ay − X β ) B Ω−1 B(Ay − X β ) as the sum of squares of the
0
transformed errors; and E εε = Ω as the variance-covariance matrix.
Jacobian term is the determinant of a full n × n matrix, e.g. |I − ρW |
SLM
spregress U2012 NM2012, ml dvarlag(W5st)
SEM
spregress U2012 NM2012, ml errorlag(W5st)
SARAR
spregress U2012 NM2012, ml dvarlag(W5st) errorlag(W5st)
SDM
spregress U2012 NM2012, ml dvarlag(W5st) ivarlag(W5st: NM2012)
SDEM
U2012 NM2012, ml errorlag(W5st) ivarlag(W5st: NM2012)
Stata syntax for MLE: spregress depvar [indepvars], ml
estimator [options]
SLM
spregress U2012 NM2012, ml dvarlag(W5st)
SEM
spregress U2012 NM2012, ml errorlag(W5st)
SARAR
spregress U2012 NM2012, ml dvarlag(W5st) errorlag(W5st)
SDM
spregress U2012 NM2012, ml dvarlag(W5st) ivarlag(W5st: NM2012)
SDEM
U2012 NM2012, ml errorlag(W5st) ivarlag(W5st: NM2012)
Stata syntax for MLE: spregress depvar [indepvars], ml
estimator [options]
SLM
spregress U2012 NM2012, ml dvarlag(W5st)
SEM
spregress U2012 NM2012, ml errorlag(W5st)
SARAR
spregress U2012 NM2012, ml dvarlag(W5st) errorlag(W5st)
SDM
spregress U2012 NM2012, ml dvarlag(W5st) ivarlag(W5st: NM2012)
SDEM
U2012 NM2012, ml errorlag(W5st) ivarlag(W5st: NM2012)
Stata syntax for MLE: spregress depvar [indepvars], ml
estimator [options]
SLM
spregress U2012 NM2012, ml dvarlag(W5st)
SEM
spregress U2012 NM2012, ml errorlag(W5st)
SARAR
spregress U2012 NM2012, ml dvarlag(W5st) errorlag(W5st)
SDM
spregress U2012 NM2012, ml dvarlag(W5st) ivarlag(W5st: NM2012)
SDEM
U2012 NM2012, ml errorlag(W5st) ivarlag(W5st: NM2012)
Stata syntax for MLE: spregress depvar [indepvars], ml
estimator [options]
SLM
spregress U2012 NM2012, ml dvarlag(W5st)
SEM
spregress U2012 NM2012, ml errorlag(W5st)
SARAR
spregress U2012 NM2012, ml dvarlag(W5st) errorlag(W5st)
SDM
spregress U2012 NM2012, ml dvarlag(W5st) ivarlag(W5st: NM2012)
SDEM
U2012 NM2012, ml errorlag(W5st) ivarlag(W5st: NM2012)
Introduction
Taxonomy of spatial models
Methods of estimation Maximum likelihood estimation
Spatial Modelling: Data-driven strategies Instrumental Variables and Generalized Method of Moments
Interpretation
Summary
General Index
1 Introduction
2 Taxonomy of spatial models
3 Methods of estimation
Maximum likelihood estimation
Instrumental Variables and Generalized Method of Moments
4 Spatial Modelling: Data-driven strategies
Specific to General modelling
General to Specific modelling
5 Interpretation
IV and GMM
The endogeneity of the Wy can also be addressed by means of an instrumental
variables or two-stage least squares (2SLS) approach:
E (y |X ) = [I − ρW ]−1 X β = I + ρW + ρ 2 W 2 + · · · X β
= X β + ρWX β + ρ 2 W 2 X β + · · ·
SLM
spregress U2012 NM2012, gs2sls dvarlag(W5st)
SEM
spregress U2012 NM2012, gs2sls errorlag(W5st)
SARAR
spregress U2012 NM2012, gs2sls dvarlag(W5st) errorlag(W5st)
SDM
spregress U2012 NM2012, gs2sls dvarlag(W5st) ivarlag(W5st: NM2012)
SDEM
U2012 NM2012, gs2sls errorlag(W5st) ivarlag(W5st: NM2012)
Stata syntax for IV/GMM: spregress depvar [indepvars],
gs2sls estimator [options]
SLM
spregress U2012 NM2012, gs2sls dvarlag(W5st)
SEM
spregress U2012 NM2012, gs2sls errorlag(W5st)
SARAR
spregress U2012 NM2012, gs2sls dvarlag(W5st) errorlag(W5st)
SDM
spregress U2012 NM2012, gs2sls dvarlag(W5st) ivarlag(W5st: NM2012)
SDEM
U2012 NM2012, gs2sls errorlag(W5st) ivarlag(W5st: NM2012)
Stata syntax for IV/GMM: spregress depvar [indepvars],
gs2sls estimator [options]
SLM
spregress U2012 NM2012, gs2sls dvarlag(W5st)
SEM
spregress U2012 NM2012, gs2sls errorlag(W5st)
SARAR
spregress U2012 NM2012, gs2sls dvarlag(W5st) errorlag(W5st)
SDM
spregress U2012 NM2012, gs2sls dvarlag(W5st) ivarlag(W5st: NM2012)
SDEM
U2012 NM2012, gs2sls errorlag(W5st) ivarlag(W5st: NM2012)
Stata syntax for IV/GMM: spregress depvar [indepvars],
gs2sls estimator [options]
SLM
spregress U2012 NM2012, gs2sls dvarlag(W5st)
SEM
spregress U2012 NM2012, gs2sls errorlag(W5st)
SARAR
spregress U2012 NM2012, gs2sls dvarlag(W5st) errorlag(W5st)
SDM
spregress U2012 NM2012, gs2sls dvarlag(W5st) ivarlag(W5st: NM2012)
SDEM
U2012 NM2012, gs2sls errorlag(W5st) ivarlag(W5st: NM2012)
Stata syntax for IV/GMM: spregress depvar [indepvars],
gs2sls estimator [options]
SLM
spregress U2012 NM2012, gs2sls dvarlag(W5st)
SEM
spregress U2012 NM2012, gs2sls errorlag(W5st)
SARAR
spregress U2012 NM2012, gs2sls dvarlag(W5st) errorlag(W5st)
SDM
spregress U2012 NM2012, gs2sls dvarlag(W5st) ivarlag(W5st: NM2012)
SDEM
U2012 NM2012, gs2sls errorlag(W5st) ivarlag(W5st: NM2012)
Introduction
Taxonomy of spatial models
Methods of estimation Specific to General modelling
Spatial Modelling: Data-driven strategies General to Specific modelling
Interpretation
Summary
General Index
1 Introduction
2 Taxonomy of spatial models
3 Methods of estimation
Maximum likelihood estimation
Instrumental Variables and Generalized Method of Moments
4 Spatial Modelling: Data-driven strategies
Specific to General modelling
General to Specific modelling
5 Interpretation
Residual tests
The first step (under STGE) is to estimate a no-spatial model and obtain the
residuals.
In our case our initial model is
U2012 = β1 + β2 NM2012 + u.
This equation is estimated under OLS:
. reg U2012 NM2012
Source | SS df MS Number of obs = 164
-------------+------------------------------ F( 1, 162) = 56.32
Model | 1453.94714 1 1453.94714 Prob > F = 0.0000
Residual | 4182.20231 162 25.8160636 R-squared = 0.2580
-------------+------------------------------ Adj R-squared = 0.2534
Total | 5636.14945 163 34.577604 Root MSE = 5.081
------------------------------------------------------------------------------
U2012 | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
NM2012 | -.7011928 .0934347 -7.50 0.000 -.8856998 -.5166859
_cons | 11.43504 .4697136 24.34 0.000 10.50749 12.36259
------------------------------------------------------------------------------
Residual tests
There are a set of tests that allow the detection of spatial autocorrelation:
Parameters in H1
Null hypotheses Test
Spatial lag Error lag
yes - LMERROR
λ =0
yes yes RLMERROR
- yes LMLAG
ρ =0
yes yes RLMLAG
No spatial
Moran´s I
autocorrelation
√
n [I − E (I )] ∼ N [0, V (I )]
as
3 Robust test: this version introduces a correction to the LMLAG under the
presence of a spatial lag λ .
0
2
0
e Wy
σ
− e σeWe
e2 2
RLMLAG = ∼ χ 2 (1)
nJeρβ − T1 as
0
WX βe M WX βe
where e are the OLS residuals, nJeρβ = T1 + e2
σ
,
0
0 −1 0 0
e e
T1 = tr W 2 + W W , M = I − X X X e2 =
X yσ n .
Spatial test in Stata
From OLS and using LM’s you are exploring SEM and SLM models.
However, the third alternative (according to the chart) was not explored.
Diagnostics
------------------------------------------------------------
Test | Statistic df p-value
-------------------------------+----------------------------
Spatial error: |
Moran’s I | 12.868 1 0.000
Lagrange multiplier | 151.248 1 0.000
Robust Lagrange multiplier | 2.171 1 0.141
|
Spatial lag: |
Lagrange multiplier | 156.114 1 0.000
Robust Lagrange multiplier | 7.037 1 0.008
------------------------------------------------------------
According to the evidence of the tests, an SDM should be estimated:
Conclusion of STGE
y = ρWy + X β + WX θ + u.
Conclusion of STGE
General Index
1 Introduction
2 Taxonomy of spatial models
3 Methods of estimation
Maximum likelihood estimation
Instrumental Variables and Generalized Method of Moments
4 Spatial Modelling: Data-driven strategies
Specific to General modelling
General to Specific modelling
5 Interpretation
The GETS starts with the most complex model and then, using LR
test, we go down, dropping non significant variables.
The GETS starts with the most complex model and then, using LR
test, we go down, dropping non significant variables.
The GETS starts with the most complex model and then, using LR
test, we go down, dropping non significant variables.
λ
b 0.83∗∗ −0.33∗∗
LRCOMFAC 6.81∗∗
∂ E (yi ) b ∂ E (yj )
= βk =0
∂ xik ∂ xik
. estat impact
progress :100%
Average impacts Number of obs = 164
--------------------------------------------------------
| Delta-Method
| dy/dx Std. Err. z P>|z|
-------------+------------------------------------------
direct |
NM2012 | -.2414164 .0700594 -3.45 0.001
-------------+------------------------------------------
indirect |
NM2012 | -.7986744 .2491086 -3.21 0.001
-------------+------------------------------------------
total |
NM2012 | -1.040091 .3029917 -3.43 0.001
--------------------------------------------------------
Example under SLM
If we apply manually the above expressions (SLM under MLE):
. mata:
---------------------- mata (type end to exit)-------------------
: b = st_matrix("e(b)")
: b
1 2 3 4
+-------------------------------------------------------------+
1 | -.1898462498 2.40790211 .8174714987 8.182474325 |
+-------------------------------------------------------------+
: rho = b[1,3]
: rho
.8174714987
: S = luinv(I(rows(W))-rho*W)
: end
-----------------------------------------------------------------
. * Total effects
. mata: (b[1,1]/rows(W))*sum(S)
-1.040090862
* Direct effects
. mata: (b[1,1]/rows(W))*trace(S)
-.2414164387
. * Indirect effects (spatial spillovers)
. mata: (b[1,1]/rows(W))*sum(S) - (b[1,1]/rows(W))*trace(S)
-.7986744231
Introduction
Taxonomy of spatial models
Methods of estimation
Spatial Modelling: Data-driven strategies
Interpretation
Summary
Summing up
Summing up
Some references
Anselin L. (2003). “Spatial Externalities, Spatial Multipliers and Spatial
Econometrics,” International Regional Science Review, 26, 153-166.
Anselin, L. and A. Bera (1998). “Spatial dependence in linear regression
models with an Introduction to Spatial Econometrics,” Handbook of
Applied Economic Statistics, pp. 237-289.
Brueckner, J. (2003). “Strategic interaction among governments: An
overview of empirical studies,” International Regional Science Review,
26(2).
Kelejian, H. H., and Prucha, I. R. (1998). A generalized spatial two-stage
least squares procedure for estimating a spatial autoregressive model with
autoregressive disturbances. The Journal of Real Estate Finance and
Economics, 17(1), 99-121.
Mur, J., and Angulo, A. (2009). Model selection strategies in a spatial
setting: Some additional results. Regional Science and Urban Economics,
39(2), 200-213.
Marcos Herrera-Gomez1
([email protected])
1 CONICET-IELDE
National University of Salta (Argentina)
General index
yt = Xt β + ut ,
where:
yt is a n × 1 vector of outcomes for each t ∈ {1, . . . , T }.
Xt is a n × k matrix of time-invariant individual explanatory
variables.
ut is a n × 1 vector of random error terms.
Problem:
This model doesn’t control by heterogeneity: specific temporal or
individual variables could be affect on dependent variable.
uit = µi + φt + εit ,
where µi is a common region-specific effect and φt is a common time-specific
effect for all regions.
These effects could be treated as fixed or random.
In the fixed effects model, a dummy variable is introduced for each region
and each time.
In the random effects model, µi (i = 1, . . . , n) is treated as a random
variable that is independently and identically distributed, i.i.d. 0, σµ2 ,
and cov (µi , εit ) = 0. (similar assumption for φt ).
M. Herrera-Gomez Spatial Panel Data Models
Introduction to panel data models
Testing spatial effects
Static spatial panel models
Dynamic spatial panel models
Common factors
Summary
controls for fixed effects only utilize the time-variant variables, whereas
RE models employ both time-series and cross-sectional variables.
2 RE model avoids the loss of degrees of freedom in comparison to fixed
cannot be estimated.
However, the random effects model should satisfied three conditions:
(1) The number of units should potentially be able to go to infinity.
(2) The units in the sample should be representative of a larger
population.
(3) The correlation between the random effects, µi (i = 1, . . . , n) and the
explanatory variables needs to be 0.
These 3 conditions do not tend to be satisfied in spatial research.
M. Herrera-Gomez Spatial Panel Data Models
Introduction to panel data models
Testing spatial effects
Static spatial panel models
Dynamic spatial panel models
Common factors
Summary
controls for fixed effects only utilize the time-variant variables, whereas
RE models employ both time-series and cross-sectional variables.
2 RE model avoids the loss of degrees of freedom in comparison to fixed
cannot be estimated.
However, the random effects model should satisfied three conditions:
(1) The number of units should potentially be able to go to infinity.
(2) The units in the sample should be representative of a larger
population.
(3) The correlation between the random effects, µi (i = 1, . . . , n) and the
explanatory variables needs to be 0.
These 3 conditions do not tend to be satisfied in spatial research.
M. Herrera-Gomez Spatial Panel Data Models
Introduction to panel data models
Testing spatial effects
Static spatial panel models
Dynamic spatial panel models
Common factors
Summary
Types of asymptotic
General Index
Simple LM Tests
Under a no-spatial pooled model, or under SLX extension, we can to test
the spatial autocorrelation on error:
Robust LM Tests
i2
ub0 (IT ⊗W )b
h 0
u
− T × T1 Jb−1 × u (ITσb⊗W )y
b
σb 2 2
2
RLMERROR = h i ∼ χ(1) .
−1 as
T × T1 1 − T × T1 J
b
General Index
where
···
y1t x11t x21t xk1t µ1
y2t x12t x22t ··· xk2t µ2
yt = .. , Xt = .. .. .. , µ = .. .
..
. . . . . .
ynt x1nt x2nt ··· xknt µn
Under random effects, this model can be written as:
yt = ρWyt + Xt β + µ + εt ,
| {z }
hut i (3)
εt ∼ N 0, σε2 In , µ ∼ N 0, σµ2 In .
0 ··· 0
βk
0 βk · · · 0
= (In − ρW )−1 . .. .. ,
.. ..
. . .
0 0 · · · βk
= (In − ρW )−1 [βk In ] , (4)
yt = Xt β + µ + εt
εt = ρW εt + ηt (5)
ηt ∼ N 0, ση2 In
yt = Xt β + µ + εt ,
| {z }
ut
εt = ρW εt + ηt ,
ηt ∼ N 0, ση2 In , µ ∼ N 0, σµ2 In ,
∂ y1 ∂ y1
∂ x1k
··· ∂ xnk
.. ..
h i
∂y
... ∂y
=
..
,
. . .
∂ x1k ∂ xnk
∂ yn ∂ yn
∂ x1k
··· ∂ x1k
···
βk w12 γk w1n γk
w21 γk βk ··· w2n γk
= (In − ρW )−1 .. .. .. ,
..
. . . .
wn1 γk wn2 γk ··· βk
= (In − ρW )−1 [βk In + γk W ] , (7)
SLM
xsmle U NM t2-t6, fe type(ind, leeyu) wmat(W5_st) mod(sar)
hausman
SEM
xsmle U NM t2-t6, fe type(ind, leeyu) emat(W5_st)
mod(sem) hausman
SDM
xsmle U NM t2-t6, fe type(ind, leeyu) wmat(W5_st) mod(sdm)
durbin(NM) hausman
SDEM
xsmle U NM wx_NM t2-t6, fe type(ind, leeyu) emat(W5_st)
mod(sem)
command xsmle
SLM
xsmle U NM t2-t6, fe type(ind, leeyu) wmat(W5_st) mod(sar)
hausman
SEM
xsmle U NM t2-t6, fe type(ind, leeyu) emat(W5_st)
mod(sem) hausman
SDM
xsmle U NM t2-t6, fe type(ind, leeyu) wmat(W5_st) mod(sdm)
durbin(NM) hausman
SDEM
xsmle U NM wx_NM t2-t6, fe type(ind, leeyu) emat(W5_st)
mod(sem)
command xsmle
SLM
xsmle U NM t2-t6, fe type(ind, leeyu) wmat(W5_st) mod(sar)
hausman
SEM
xsmle U NM t2-t6, fe type(ind, leeyu) emat(W5_st)
mod(sem) hausman
SDM
xsmle U NM t2-t6, fe type(ind, leeyu) wmat(W5_st) mod(sdm)
durbin(NM) hausman
SDEM
xsmle U NM wx_NM t2-t6, fe type(ind, leeyu) emat(W5_st)
mod(sem)
command xsmle
SLM
xsmle U NM t2-t6, fe type(ind, leeyu) wmat(W5_st) mod(sar)
hausman
SEM
xsmle U NM t2-t6, fe type(ind, leeyu) emat(W5_st)
mod(sem) hausman
SDM
xsmle U NM t2-t6, fe type(ind, leeyu) wmat(W5_st) mod(sdm)
durbin(NM) hausman
SDEM
xsmle U NM wx_NM t2-t6, fe type(ind, leeyu) emat(W5_st)
mod(sem)
Introduction to panel data models
Testing spatial effects
Static spatial panel models
Dynamic spatial panel models
Common factors
Summary
Alternative Models
yt = τyt−1 + ρWyt + Xt β + µ + εt .
2 Pure Recursive
yt = γWyt−1 + Xt β + µ + εt .
3 Spatio-temporal Recursive
Simultaneous spatio-temporal
yt = τyt−1 + ρWyt + Xt β + µ + εt .
1 The dynamic structure is explicit with an inter-temporal contagion
that multiplies through the impact of contemporary neighbours.
2 The contemporary spatial effect hinders the use of this model for
predictive purposes:
The individual reacts immediately to his neighbours, although he is
also affected by his past.
3 The estimation can be done by GMM or MV.
4 Stationarity condition is required.
Pure Recursive
yt = γWyt−1 + Xt β + µ + εt .
1 The dynamic structure is indirect but exists:
Example: y1t depends on ywi ,t−1 which, in turn, depends on y1,t−2 .
2 It is useful for the innovation diffusion model (Upton and Fingleton,
1985) or contagion-models (COVID-19).
3 The estimation can be done using instrumental variables in the
traditional way or GMM and MV.
Spatio-temporal Recursive
yt = γWyt−1 + Xt β + WXt θ + µ + εt .
3 Spatio-temporal Recursive
xsmle command
SLM 1
xsmle U NM, dlag(1) fe wmat(W5_st) type(both) mod(sar)
effects nsim(499)
SLM 2
xsmle U NM, dlag(2) fe wmat(W5_st) type(both) mod(sar)
effects nsim(499)
SLM 3
xsmle U NM, dlag(3) fe wmat(W5_st) type(both) mod(sar)
effects nsim(499)
xsmle command
SLM 1
xsmle U NM, dlag(1) fe wmat(W5_st) type(both) mod(sar)
effects nsim(499)
SLM 2
xsmle U NM, dlag(2) fe wmat(W5_st) type(both) mod(sar)
effects nsim(499)
SLM 3
xsmle U NM, dlag(3) fe wmat(W5_st) type(both) mod(sar)
effects nsim(499)
xsmle command
SLM 1
xsmle U NM, dlag(1) fe wmat(W5_st) type(both) mod(sar)
effects nsim(499)
SLM 2
xsmle U NM, dlag(2) fe wmat(W5_st) type(both) mod(sar)
effects nsim(499)
SLM 3
xsmle U NM, dlag(3) fe wmat(W5_st) type(both) mod(sar)
effects nsim(499)
General Index
General Index
1 n 1 n
yt = ∑ yit , y t−1 = ∑ yi,t−1
n i=1 n i=1
1 n
xt = ∑ xikt , (k = 1, ..., K )
n i=1
The problem with temporal fixed effects is that each dummy has the
same impact on all observations for period t, in this case a temporal
heterogeneity is introduced.
Problem with this strategy: the parameters grow to n + (2 + K ) × n.
Empirically, introducing the time effects of y t and y t−1 is effective in
capturing unobservable heterogeneity (Cicarelli and Elhorst, 2018).
M. Herrera-Gomez Spatial Panel Data Models
Introduction to panel data models
Testing spatial effects
Static spatial panel models General Nested Spatial model with common factors
Dynamic spatial panel models Modelling Common Factors
Common factors
Summary
!
n−1 n
2n
ρn = ∑ ∑ ρij = O n2α−2 ,
n (n − 1) i=1 j=i+1
The α can be estimated consistently only for 0.5 < α ≤ 1. Use Pesaran’s
CD test to find out whether α is smaller or greater than 0.5.
Summing up
For panel data, recent developments in Stata provide
alternatives for estimating static and dynamic models.
Dynamic spatial econometric models for spatial panels with
common factors (CF) are one of the most advanced models
currently available for empirical research.
Stata contains the alternative commands to implement this
models and tests.
Main results of the impact of net migration:
Static Panel model: SDM and the SDEM show a negative
impact in unemployment (NEG theory).
Dynamic Panel model: All competitive models show a negative
impact in short and long run. Results in line with the NEG
theory. (Caution: this is an illustrative example, dynamic panel
models require a larger time dimension)
M. Herrera-Gomez Spatial Panel Data Models
Introduction to panel data models
Testing spatial effects
Static spatial panel models
Dynamic spatial panel models
Common factors
Summary
Summing up
For panel data, recent developments in Stata provide
alternatives for estimating static and dynamic models.
Dynamic spatial econometric models for spatial panels with
common factors (CF) are one of the most advanced models
currently available for empirical research.
Stata contains the alternative commands to implement this
models and tests.
Main results of the impact of net migration:
Static Panel model: SDM and the SDEM show a negative
impact in unemployment (NEG theory).
Dynamic Panel model: All competitive models show a negative
impact in short and long run. Results in line with the NEG
theory. (Caution: this is an illustrative example, dynamic panel
models require a larger time dimension)
M. Herrera-Gomez Spatial Panel Data Models
Introduction to panel data models
Testing spatial effects
Static spatial panel models
Dynamic spatial panel models
Common factors
Summary
Some references
Theoretical references:
Anselin, L., Gallo, J. L., & Jayet, H. (2008). Spatial panel econometrics. In The
econometrics of panel data (pp. 625-660). Springer, Berlin, Heidelberg.
Bailey, N., Kapetanios, G., & Pesaran, M. H. (2016). Exponent of
cross-sectional dependence: Estimation and inference. Journal of Applied
Econometrics, 31(6), 929-960.
Elhorst, J. P., Gross, M., & Tereanu, E. (2021). Cross-sectional dependence and
spillovers in space and time: Where spatial econometrics and global var models
meet. Journal of Economic Surveys, 35(1), 192-226.
Applied references:
Elhorst et al. (2020): Persistent habit car (Spatio-temporal recursive SDM with
CF).
Jung et al (2014): impact of poverty’s programs (Spatio-temporal recursive
SDM).
Keller and Shiue (2007): historical analysis of rice’s price (simultaneous
spatio-temporal SLM).
Montmartin and Herrera (2015): R&D investment in OCDE countries
(Spatio-temporal recursive SDM).
View publication stats
M. Herrera-Gomez Spatial Panel Data Models