[R] Prediction intervals (i.e. not CI of the fit) for monotonic loess curve using bootstrapping
dwinsemius at comcast.net
Tue Aug 12 17:20:06 CEST 2014
On Aug 12, 2014, at 12:23 AM, Jan Stanstrup wrote:
> I am trying to find a way to estimate prediction intervals (PI) for a monotonic loess curve using bootstrapping.
> At the moment my approach is to use the boot function from the boot package to bootstrap my loess model, which consist of loess + monoproc from the monoproc package (to force the fit to be monotonic which gives me much improved results with my particular data). The output from the monoproc package is simply the fitted y values at each x-value.
> I then use boot.ci (again from the boot package) to get confidence intervals. The problem is that this gives me confidence intervals (CI) for the "fit" (is there a proper way to specify this?) and not a prediction interval. The interval is thus way too optimistic to give me an idea of the confidence interval of a predicted value.
> For linear models predict.lm can give PI instead of CI by setting interval = "prediction". Further discussion of that here:
> However I don't see a way to do that for boot.ci. Does there exist a way to get PIs after bootstrapping? If some sample code is required I am more than happy to supply it but I thought the question was general enough to be understandable without it.
Why not use the quantreg package to estimate the quantiles of interest to you? That way you would not be depending on Normal theory assumptions which you apparently don't trust. I've used it with the `cobs` function from the package of the same name to implement the monotonic constraint. I think there is a worked example in the quantreg package, but since I bought Koenker's book, I may be remembering from there.
Alameda, CA, USA
More information about the R-help