[R] glm and gam confidence intervals

Simon Wood simon at stats.gla.ac.uk
Fri May 16 12:21:53 CEST 2003

> How can I obtain the values of confidence intervals from gam anf glm 
> objects?
- 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 Wood simon at stats.gla.ac.uk        www.stats.gla.ac.uk/~simon/
>>  Department of Statistics, University of Glasgow, Glasgow, G12 8QQ
>>>   Direct telephone: (0)141 330 4530          Fax: (0)141 330 4814

More information about the R-help mailing list