I wanted to model some data with heteroscedastic errors using a gls model of the form
library(nlme)
gls(y ~ x, data = data, weights=varPower(1, form= ~y))
That is, with the variance being a power function of the dependent variable y (or the independent variable x?). See link here for an example.
For my application I would also need 95% prediction intervals on the model predictions for a specific value of x. Would anybody know how to calculate these for a gls model with this kind of error structure? (gls does not appear to provide for a predict method with interval="prediction") Or alternative approaches that would allow for such an error structure and allow me to calculate prediction intervals? (A solution using weighted regression is posted here, but I would prefer to use gls instead, as that fits the appropriate power coefficient describing the mean-variance relationship)