[R-sig-Geo] Impact measures in spatial panels when regressors are endogenous. I need some help by a reproducible example.
Roger Bivand
Roger@B|v@nd @end|ng |rom nhh@no
Thu Mar 5 14:17:42 CET 2020
On Mon, 2 Mar 2020, André M. Marques via R-sig-Geo wrote:
> Dear all, I am working on a research project that uses spatial panel
> econometric models.
>
> At this moment I am facing some difficulties because I guess there are
> some issues with the function impacts() in spatialreg package and also
> with impacts.splm() of the splm package.
>
> I already have used these codes previously.
>
> But at this time I have endogenous regressors in Cliff-Ord spatial panel
> model. The major issue I have found is to calculate the impacts when I
> have one endogenous variable (~pcap) and two exogenous instruments
> (~hwy+water) in a SARAR spatial panel model.
I do not think that impacts methods have been implemented for this case.
The error message should lead you through traceback() and
debug(splm:::impacts.splm) to
Error in impacts.splm(GM_sarar.w2sls, tr = trMatc, R = 200) :
object type not recognized
Contributions welcome!
Roger
PS. Do not post in HTML, as HTML always destroys the plain-text nature of
code - this example was OK, but getting it to run cost a lot of
unecessarily wasted time.
>
> Below I present a simple reproducible example: library(plm)
> library(splm)
> library(spdep)data("Produc",package='plm') # Panel data.
> head(Produc)data("usaww", package="splm")
> head(usaww) usalw <- mat2listw(usaww,style='W') # mat2listw() X nb2listw()
> summary(usalw)fm <- log(gsp) ~ log(pcap) + log(pc) + log(emp) + unemp GM_sarar.w2sls <- spgm(formula=fm,data=Produc,listw=usalw,lag=TRUE,
> model="random",spatial.error=TRUE,
> endog = ~pcap,instruments= ~hwy+water,
> lag.instruments = TRUE,method="w2sls")
> summary(GM_sarar.w2sls) data(usaww)
> lwstates <- mat2listw(usaww, style ="W")
> sparse.W <- listw2dgCMatrix(lwstates)
>
> time <- length(unique(Produc$year))
> s.lwstates <- kronecker(Diagonal(time), sparse.W)
>
> set.seed(12345)
> trMatc <- spatialreg:::trW(s.lwstates, type="mult")
> imp <- impacts(GM_sarar.w2sls, tr = trMatc, R = 200)
> summary(imp, zstats=TRUE, short=T)
>
> class(GM_sarar.ec2sls)
>
> [1] "splm" Could someone please try to solve this issue by a
> reproducible example?
>
>
> Best regards,
>
> André M. Marques
>
> Federal University of Paraiba
> Department of Economics
> Graduate Program of Economics
>
> [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo using r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>
--
Roger Bivand
Department of Economics, Norwegian School of Economics,
Helleveien 30, N-5045 Bergen, Norway.
voice: +47 55 95 93 55; e-mail: Roger.Bivand using nhh.no
https://orcid.org/0000-0003-2392-6140
https://scholar.google.no/citations?user=AWeghB0AAAAJ&hl=en
More information about the R-sig-Geo
mailing list