ciTools
ciTools copied to clipboard
Support gls models?
Would it also be possible for the package to support confidence and prediction intervals for gls models?
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.
I'm also not sure how users commonly fit GLS models in R. I assume this is done with the nlme package?
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...