[R] loess prediction limits

David J. Netherway david.netherway at adelaide.edu.au
Wed Jun 2 06:24:13 CEST 2004


Hello

I am plotting a loess curve with confidence limits as below.
How do I create the prediction limits? Is multiplying the standard
errors by sqrt(n) appropriate?
 
data <- mndata
lo <- loess(data[[variableName]] ~ Age, data, span=1.0,
       control = loess.control(surface = "direct"))
xPoints <- data.frame(age = seq(1,240,1))
lo1 <- predict(lo, xPoints, se = TRUE)
age <- xPoints$age
lines(age,lo1$fit, col=4)
# now do +/- 2 std errors
lo1p <- lo1$fit + 2*lo1$se.fit
lo1m <- lo1$fit - 2*lo1$se.fit
lines(age,lo1p, col=4)
lines(age,lo1m, col=4)

Thanks, David




More information about the R-help mailing list