r-spatial / spatialreg

spatialreg: spatial models estimation and testing
https://r-spatial.github.io/spatialreg/
41 stars 12 forks source link

Confidence interval for spautolm object #29

Closed darunabas closed 1 year ago

darunabas commented 2 years ago

Is there a way to obtain confidence interval for a spautolm object?

While it is straightforward to get confidence intervals for objects from functions like lagsarlm by applying confint(mod) to, it didn’t work for spautolm object. Could anyone please provide some guidance on how to get confidence interval from a spautolm object?

Instead, I get an error:


  no applicable method for 'vcov' applied to an object of class "Spautolm"```
rsbivand commented 2 years ago

The underlying reason is that there was no need to estimate the full variance covariance matrix when the function was written almost 20 years ago to implement Waller and Gotway, as the fixed part (covariates) is given once the spatial coefficient is estimated. Since then, a route via Hessian was added, but the public health ML approach doesn't need the vcov tools, as the spatial coefficient is just a nuisance parameter. If you'd like to contribute a well-tested PR for all of the SAR, CAR and SMA cases, I'll look at it. If you only need SAR, use errorsarlm() not spautolm().