|
Dear S-Plus Users, (using S-Plus 6.2 for Windows)
A colleague of mine has asked how he can derive (and save) "95% prediction intervals" for a high degree Generalised Additive Model he has fitted. The resulting graphic that he would produce would be something like the pointwise confidence intervals one can get from the command plot(gam.object, se=T).
I know I can use ...
predict.gam( fit.gam, type="response", se.fit=T, pi.fit=T)
but this gives me prediction intervals only about the linear portion of the GAM.
I seem to have lost my original reference to how I calculated confidence bands using jacknife residuals ...
fit <- smooth.spline(NYear,NYield,df=40) res <- (fit$yin - fit$y)/(1-fit$lev) # jacknife residuals sigma <- sqrt(var(res)) # estimate of standard deviation upper <- fit$y + 2.0 * sigma * sqrt(fit$lev) # upper 95% confidence band lower <- fit$y - 2.0 * sigma * sqrt(fit$lev) # lower 95% confidence band
... but cannot help but feel the formula I need may be something like
upper <- fit$y + 2.0 * sqrt( sigma^2 * (1 + fit$lev))
lower <- fit$y - 2.0 * sqrt( sigma^2 * (1 + fit$lev))
... and that way bring in the variance about an individual point.
Any advice / insights would be gratefully accepted.
thanks, Terry
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Terry Koen Senior Biometrician ph: +61 2 63419119 CNR Research Centre fx: +61 2 63424551 Dept Natural Resources P.O. Box 445 Cowra 2794 NSW email: Terry.Koen@dnr.nsw.gov.auAustralia ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-----------------------------------------------------
This message is intended for the addressee named and may contain confidential/privileged information. If you are not the intended recipient, please delete it and notify the sender.
Views expressed in this message are those of the individual sender, and are not necessarily the views of the Department.
You should scan any attached files for viruses.
-----------------------------------------------------
|