Skip to content

glm and gam confidence intervals

3 messages · David Nogués, Brian Ripley, Simon Wood

#
How can I obtain the values of confidence intervals from gam anf glm 
objects?

Thanks in advance
#
On Fri, 16 May 2003, David Nogu?s wrote:

            
Confidence intervals of what?  (You do need to be more precise.)

For the coefficients of a glm, see profile.glm in MASS.
For predictions you can get asymptotic (normal-based) CIs from the 
predict(se=TRUE) results on link scale and transform.

For gams it is a lot trickier, as for example there may be multiple local 
maxima to the likelihood, and there may be non-interval confidence regions 
for predictions as a result.
#
- Vp in the gam object is the covariance matrix of the posterior
distribution of the gam parameters under a certian Bayesian model of
smoothing, the mean of this distribution is the parameter estimates
(coefficients). In the large sample limit the distribution is normal
(exactly so for normal errors and identity link). 

- predict.gam() can give standard errors for any prediction that you ask
it to make (on the scale of the linear predictor these are exact and do
not, for example, rely on any approximations like the estimators of the
smooths being independent). CI's then obtainable from the large sample 
normal result.

- predict.gam() with the type="lpmatrix" will give you the matrix by which
the fitted gam coefficients must be multiplied in order to obtain the
vector of required predictions (on the scale of the linear predictor).
This can be used to obtain the covariance matrix for the predictions
directly from the covariance matrix of the parameters. 

- Confidence intervals for complicated quantities derived from a fitted
gam object can be obtained by simulating parameter sets from the
multivariate normal with mean given by the fitted coefficients and
covariance matrix Vp and re-computing the derived quantity from each. 

Simon

_____________________________________________________________________