1

I want to estimate the spatial panel autoregressive model

y_{t} = a + \rho W y_{t} + \epsilon_{t}

where a is a vector of individual fixed effects. I am using the excellent splm package in R.

Note that I don't have any independent variables X here - if I include some regressors X there is no problem, but I wonder how to specify the model with splm in the absence of independent variables.

library(splm)
library("spdep")
data("Produc", package = "Ecdat")
data("usaww")
usalw <- mat2listw(usaww)

# this works well since I have independent regressors
spml(formula = log(gsp) ~ log(pcap), data = Produc,
     listw = usaww, lag = TRUE, spatial.error = "none", model = "within",
     effect = "twoways")

 # this does not work
 spml(formula = log(gsp) ~ ., data = Produc,
      listw = usaww, lag = TRUE, spatial.error = "none", 
      model = "within", effect = "individual")
user436994
  • 601
  • 5
  • 15
  • Just came across this: https://stackoverflow.com/questions/34369109/r-plm-individual-and-time-fixed-effects-but-no-other-regressors. Maybe there is no way to do this in `splm`? – user436994 Apr 01 '19 at 13:57

1 Answers1

1

To estimate an "empty" model (intercept only) the formula has to be y ~ 1. This currently works with random or no individual effects, "within" (fixed effects) estimators need a fix. A workaround for getting the FE estimates: explicit demeaning of the data

    library(plm)
    spml(formula = Within(log(gsp)) ~ 1, data = Produc,
         listw = usaww, lag = TRUE, spatial.error = "none", 
         model = "pooling")