[R-sig-Geo] Calculating impact measures for spatial panel models and trouble specifying SDEM model using spml
Letisha Sarah Fong Rui Zhen
geo|@|rz @end|ng |rom nu@@edu@@g
Wed Jul 24 10:03:03 CEST 2019
Dear all,
I�m working with panel data of 9 countries and 18 years and I�m running fixed effects SDEM, SLX and SEM with the splm package.
I have three questions:
1. I can�t seem to get the SDEM model to run. My code for each of the 3 models is:
model.SDEM <- spml(ln(Y) ~ ln(GDP) + (ln(GDP))^2 + EI + RE + slag(ln(GDP), listw = my.listw) + slag((ln(GDP))^2, listw = my.listw), data = my.data, listw = my.listw, model = �within�, effect = �individual�, lag = F, spatial.error = �b�)
model.SLX <- plm(ln(Y) ~ ln(GDP) + (ln(GDP))^2 + EI + RE + slag(ln(GDP), listw = my.listw) + slag((ln(GDP))^2, listw = my.listw), data = my.data, model = �within�, effect = �individual�)
model.SEM <- spml(ln(Y) ~ ln(GDP) + (ln(GDP))^2 + EI + RE, data = my.data, listw = my.listw, model = �within�, effect = �individual�, lag = F, spatial.error = �b�)
I am able to run both SLX and SEM models without problem, but when I try to run the SDEM model, the error message is:
Error in UseMethod("slag") :
no applicable method for 'slag' applied to an object of class "c('double', 'numeric')"
I don�t understand what is wrong here, as I have no problems with the slag() function in the SLX model. My data is a pdataframe and each variable is a numeric pseries.
2. How can I calculate impact measures (direct, indirect and total) for spatial panel models?
The impacts() function in spdep doesn�t work anymore and the impacts() function from the spatialreg package seems to work only for cross-sectional data and not panel data.
For example, I ran:
spatialreg::impacts(model.SLX)
And the error message is:
Error in UseMethod("impacts", obj) :
no applicable method for 'impacts' applied to an object of class "c('plm', 'panelmodel')"
I have tried methods(impacts) but none of the functions seem to work for my SLX model created with the splm package.
I also looked at some previous examples in the splm documentation and more specifically the spml() function and the example provided (specifically the impact measures) doesn�t work anymore:
data(Produc, package = "plm")
data(usaww)
fm <- log(gsp) ~ log(pcap) + log(pc) + log(emp) + unemp
## random effects panel with spatial lag
respatlag <- spml(fm, data = Produc, listw = mat2listw(usaww),
model="random", spatial.error="none", lag=TRUE)
summary(respatlag)
## calculate impact measures
impac1 <- impacts(respatlag, listw = mat2listw(usaww, style = "W"), time = 17)
summary(impac1, zstats=TRUE, short=TRUE)
The error message when I run the impacts() function is:
Error in UseMethod("impacts", obj) :
no applicable method for 'impacts' applied to an object of class "splm"
My question is therefore, how do I go about calculating direct, indirect and total impact measures for spatial panel data?
3. How can I test if the SDEM model can be simplified to the SLX model (since I estimate the SDEM by maximum likelihood (spml function) and the SLX by ordinary linear regression (plm function))? From my understanding the plm() function does not compute a loglikelihood or AIC so I probably can�t do a likelihood ratio test to choose between models (I haven�t tried this out because I�m stuck at running the SDEM model).
Any help or advice would be greatly appreciated. Thank you.
Best wishes,
Sarah
________________________________
Important: This email is confidential and may be privileged. If you are not the intended recipient, please delete it and notify us immediately; you should not copy or use it for any purpose, nor disclose its contents to any other person. Thank you.
[[alternative HTML version deleted]]
More information about the R-sig-Geo
mailing list