[R-sig-Geo] Help to calculate the impacts using the spreg function in sphet package: GMM/IV with one endogenous and one instrument
André M. Marques
@ndremm@rque@ @end|ng |rom y@hoo@com@br
Sat May 2 18:43:13 CEST 2020
Dear all,
I apologize for my previous unclear code in the mail list.Now I hope to be clear about the problem I am facing in the following example:
require("sf", quietly=TRUE)library(sphet)library(spatialreg)
columbus <- st_read(system.file("shapes/columbus.shp", package="spData")[1], quiet=TRUE)require("spdep", quietly=TRUE)col.gal.nb <- spdep::read.gal(system.file("weights/columbus.gal", package="spData")[1])listw <- spdep::nb2listw(col.gal.nb)
# I have one endongenous (HOVAL) and one instrument (PLUMB) ## endo=~HOVAL ; instruments=~PLUMB
res.spreg <- spreg(CRIME ~ INC + OPEN, columbus, listw,endo=~HOVAL,lag.instr = TRUE,instruments=~PLUMB,model=c('ivhac'),het=TRUE,HAC=FALSE)
class(res.spreg)#[1] "sphet" "gstsls"summary(res.spreg)
Now the problem: I'm unable to calculate the impacts and their p-values in a (cross-section) Cliff-Ord model based on GMM/IV:
W <- as(listw, "CsparseMatrix")trMatc <- trW(W, type="mult")trMC <- trW(W, type="MC")
set.seed(1234)impacts(res.spreg, listw=listw)
# I get the error message:Error in spatialreg::intImpacts(rho = rho, beta = beta, P = P, n = n, : argumento "evalues" ausente, sem padrãoAlém disso: Warning message:Function intImpacts moved to the spatialreg package
# or even when I try:library(coda)lobjIQ5 <- impacts(res.spreg, tr=trMatc, R=200, Q=5)summary(lobjIQ5, zstats=TRUE, short=TRUE)# I got the same error message.
## When I use the 'evalues' argument as the vector of eigenvalues of spatial weights matrix:
ev <- eigenw(listw)impacts(res.spreg, evalues=ev)
# Even in this way I got the same error message.
Thanks for help.
Best wishes,
André M. Marques
Federal University of ParaibaGraduate Program of Economics
[[alternative HTML version deleted]]
More information about the R-sig-Geo
mailing list