Skip to content
Prev 28047 / 29559 Next

Help to calculate the impacts using the spreg function in sphet package: GMM/IV with one endogenous and one instrument

On Sat, 2 May 2020, Andr? M. Marques via R-sig-Geo wrote:

            
Had you followed list rules and posted plain text, things might have been 
clearer. HTML tries to make code look like a paragraph of text, so messes 
everything up. This is a plain-text version:

library(sphet)
library(spatialreg)
columbus <- sf::st_read(system.file("shapes/columbus.shp",
   package="spData")[1], quiet=TRUE)
col.gal.nb <- spdep::read.gal(system.file("weights/columbus.gal",
   package="spData")[1])
listw <- spdep::nb2listw(col.gal.nb)
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)
summary(res.spreg)
impacts(res.spreg, listw=listw)

This indicates a mismatch firstly between released spatialreg and spdep in 
handling impacts for some sphet objects, and further that the IV case may 
not yet be covered. Please provide this reproducible example on 
https://github.com/r-spatial/spatialreg/issues and ping the sphet 
maintainer.

Roger