Can anyone help me calculating CIs from a GAM analysis?

I have calculated a GAM fit (m3) and the associated std errors using
predict.gam
I assume that the 95% CI around each fit value would be 1.96
times the se.    But when I do this both on the original and a test
dataset, I find the CI's only encompass about half of the true response
values.     I have  tried this using predict.gam using both type="response"
and type="link"  and get nearly the same result.  What am I  doing wrong?

Here is the code I am using to get the 95% CIs.

se3=predict.gam(m3,dat, type="response", se.fit=TRUE)

upr <- se3$fit + (1.96 * se3$se.fit)
upr <- m3$family$linkinv(upr)
lwr <- se3$fit - (1.96 * se3$se.fit)
lwr <- m3$family$linkinv(lwr)
CI95=upr-lwr
CI95=CI95/2

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to