I have some data that I fitted using a LOESS model in R, giving me this:
The data has one predictor and one response, and it is heteroscedastic.
I also added confidence intervals. The problem is that the intervals are confidence intervals for the line, whereas I am interested in the prediction intervals. For example, the bottom panel is more variable then the top panel, but this is not captured in the intervals.
This question is slightly related:
Understanding the confidence band from a polynomial regression, especially the answer by @AndyW, however in his example he uses the relatively straightforward interval="predict"
argument that exists in predict.lm
, but it is absent from predict.loess
.
So I have two very related questions:
- How do I get the pointwise prediction intervals for LOESS?
- How can I predict values that will capture that interval, i.e. generate a bunch of random numbers that will eventually look somewhat like the original data?
It is possible that I don't need LOESS and should use something else, but I am unfamiliar with my options. Basically it should fit the line using local regression or multiple linear regression, giving me error estimates for the lines, and in addition also different variances for different explanatory variables, so I can predict the distribution of the response variable (y) at certain x values.