Dear all,
# I am facing the following problem in calculating the impacts and their significance based on 'impacts' function in# {spatialreg} package:# I have one endogenous (HOVAL) and one instrument (PLUMB) ## endo=~HOVAL ; instruments=~PLUMB
# How can I calculate the impact measures and their significance based on GMM/IV of 'spreg ( )' function in sphet package# when I have one endogenous and one instrument?
# My reproducible 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 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:library(coda)lobjIQ5 <- impacts(res.spreg, tr=trMatc, R=200, Q=5)summary(lobjIQ5, zstats=TRUE, short=TRUE)
# When I use the 'evalues' argument as the vector of eigenvalues of spatial weights matrix:
ev <- eigenw(listw)impacts(res.spreg, evalues=ev)
# I get the error:
Error in spatialreg::intImpacts(rho = rho, beta = beta, P = P, n = n,? :?? argumento "evalues" ausente, sem padr?o
Thanks for some help,
Best wishes,
Andr? M. MarquesFederal University of Paraiba
Department of EconomicsGraduate Program of Economics
Help to calculate the impacts using the spreg function in sphet package: GMM/IV with one endogenous and one instrument
1 message · André M. Marques