In one of my papers (The Effects of Dust Storms on Economic Development), I implement an instrumental variables regression where I expect to encounter spatial and serial correlation in the error term, and wanted to adjust standard errors accordingly. While there is an existing command out there for estimating Conley spatial correlation models alongside heteroskedasticity-autocorrelation (HAC) robust standard errors (see Sol Hsiang’s code for ols_spatial_HAC here and a version using reg2hdfe from Thiemo Fetzer here), I have not found a command for implementing the procedure in an instrumental variables setting. So I have adapted Sol’s code to be able to do this, building on top of ivreg2. You can install the command through ssc, using
ssc install spatial_hac_iv
The command works with ivreg2 syntax, but requires the same options as ols_spatial_HAC, namely
lat(latvar) lon(lonvar) Timevar(tvar) Panelvar(pvar)
with optional [DISTcutoff(#) LAGcutoff(#) bartlett DISPlay star dropvar]
A version that implements the same procedure in R is planned to follow, so check back later for that as well.