How to estimate a Spatial Autoregressive model in R?
Asked Answered
E

1

7

I am trying to estimate some spatial models in R using the data from a paper on spatial econometric models using cross-section time series data by Franzese & Hays (2007). I focus on their results given in table 4 (see below). Using lm I am able to replicate their results for the OLS, S-OLS, and S-2SLS models. However, in trying to estimate the S-ML (Spatial Maximum Likelihood) model I run into trouble.

Table 4 from Franzese & Hays (2007)

If I use a GLM model there are some minor differences for some of the explanatory variables but there is quite a large margin with regard to the estimated coefficient for the spatial lag (output shown below). I'm not entirely sure about why GLM is not the right estimation method in this case. Using GLS I get results similar to GLM (possibly related).

require(MASS)
    m4<-glm(lnlmtue~lnlmtue_1+SpatLag+DENSITY+DEIND+lngdp_pc+UR+TRADE+FDI+LLVOTE+LEFTC+TCDEMC+GOVCON+OLDAGE+factor(cc)+factor(year),family=gaussian,data=fh)
summary(m4)

Coefficients:
                    Estimate   Std. Error t value    Pr(>|t|)    
(Intercept)          7.199091355  3.924227850   1.835    0.068684 .  
lnlmtue_1            0.435487985  0.080844033   5.387 0.000000293 ***
SpatLag             -0.437680018  0.101078950  -4.330 0.000028105 ***
DENSITY              0.007633016  0.010268468   0.743    0.458510    
DEIND                0.040270153  0.032304496   1.247    0.214618 

I tried using the splm package but this leads to even larger consistencies (output shown below). Moreover, I'm not able to include fixed effects in the model.

require(splm)
m4a<-spml(lnlmtue~lnlmtue_1+DENSITY+DEIND+lngdp_pc+UR+TRADE+FDI+LLVOTE+LEFTC+       TCDEMC+GOVCON+OLDAGE,data=fh,index=c("cc","year"),listw=mat2listw(wmat),
      model="pooling",spatial.error="none",lag=T)
summary(m4a)


Coefficients:
           Estimate  Std. Error t-value Pr(>|t|)    
(Intercept)  1.79439070  0.78042284  2.2993  0.02149 *  
lnlmtue_1    0.75795987  0.04828145 15.6988  < 2e-16 ***
DENSITY     -0.00026038  0.00203002 -0.1283  0.89794    
DEIND       -0.00489516  0.01414457 -0.3461  0.72928 

So basically my question really is how does one properly estimate a SAR model with cross-section time-series data in R?

R-code

Replication data

Adjacency matrix

Extracellular answered 10/4, 2014 at 14:45 Comment(2)
check out the spdep package (more generally see the Spatial task view)Trumaine
As far as I am aware spdep doesn't handle time-series cross-section data.Extracellular
F
0

Is it critical that you use R?

I suggest that you examine the features of Geoda, a free spatial analysis package available from Arizona State University.

Though I have only used it to run basic spatial OLS (not 2SLS), I was pleased with Geoda's flexibility and visualization tools. I encourage you to skim the documentation and consider downloading the latest release.

If you must use R, I suggest exploring the GeoXp package (http://cran.r-project.org/web/packages/GeoXp/index.html).

Fielding answered 30/8, 2014 at 1:26 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.