0
$\begingroup$

I have a panel data structure. I want to compare the forecast of simple panel regression with individual fixed effects with the same individual fixed effects Spatial Autoregressive Model (SAR) with only spatial autoregressive of the dependent Y variable. I use plm package for panel regression and splm package for spatial ones. I am new to spatial econometrics so I don't fully understand the math beyond spatial regression. The biggest problem I face so far is that predict method in either stats, plm and spmod is not designed for spatial kinds of models. The only spatial model I can't use for forecasting is the Spatial Lag Model (SLX) since it is estimated by the simple plm method with some spatial lag of the independent variable\s.

As an example, I use US States Production from plm package.

library(tidyverse)
library(plm)
library(splm)

data(Produc, package = "plm")
data(usaww)

formula <- log(gsp) ~ log(pcap) + log(pc) + log(emp) + unemp

# panel regression
plm_reg <- plm::plm(formula = formula, data = filter(Produc, year != 1986), model = "within", effect = "individual", index = c("state", "year"))
summary(plm_reg)

# SAR
splm_reg <- splm::spml(formula = formula, data = filter(Produc, year != 1986), listw = spdep::mat2listw(usaww), model = "within", effect = "individual", spatial.error = "none", lag = TRUE, index = c("state", "year"))
summary(splm_reg)

# panel forecast
plm_pred = plm:::predict.plm(object = plm_reg, newdata = pdata.frame(Produc, index = c("state", "year")))
View(plm_pred)

# SAR forecast
splm_pred = predict(object = splm_reg, pdata.frame(Produc, index = c("state", "year"))) # error 

The second issue I faced is that the right-hand side of the equation contains a dependent variable, so if I want to predict for t+1 period I need to have Y variable, which is pointless since I want to predict the value of Y variable in the period t+1. The answer to the question Spatial econometrics -- computing residuals suggests, that I can reduce ρWy to (I - ρW)^-1 after some algebraic manipulations: $$ y=ρWy+xb $$ to $$ y=(I−ρW)^{−1} (xb+e) $$

Does it mean, that I can use plm with (I - ρW)^-1 where ρ is a Moran's I (for instance) to estimate the SAR model?

Anyway, I am looking for suggestions on performing a forecast with spatial panel data in R or Python. I would appreciate for any help.

$\endgroup$

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.