jthaman / ciTools

An R Package for Quick Uncertainty Intervals
GNU General Public License v3.0
106 stars 8 forks source link

Support gls models? #31

Open tomwenseleers opened 6 years ago

tomwenseleers commented 6 years ago

Would it also be possible for the package to support confidence and prediction intervals for gls models?

jthaman commented 6 years ago

Thanks for this question. It would be nice to have this feature in ciTools. I'm a bit busy with the intervals associated with lmers and glmers right now. Do you have a reference on the math behind CIs and PIs for GLS models? That would be the first step for us.

jthaman commented 6 years ago

I'm also not sure how users commonly fit GLS models in R. I assume this is done with the nlme package?

tomwenseleers commented 6 years ago

Yes nlme::gls is the common one; there is also MASS:lm.gls, which has a predict method with a SE.fit argument. I noticed this paper where they calculated prediction intervals for a gls model, https://pubs.usgs.gov/wri/1994/4155/report.pdf, but in this thread they seem to indicate it's not so trivial : https://stat.ethz.ch/pipermail/r-help/2003-May/033891.html. I think it's easy if only the weights argument is given (as it's basically equivalent to weighted least squares then), but not if more complex within-group correlation structures are specified using the correlation argument...