gam.check {mgcv}R Documentation

Some diagnostics for a fitted gam model

Description

Takes a fitted gam object produced by gam() and produces some diagnostic information about the fitting procedure and results. The default is to produce 4 residual plots, and some information about the convergence of the smoothness selection optimization.

Usage

gam.check(b, old.style=FALSE,
          type=c("deviance","pearson","response"),
          rep=0, level=.9, rl.col=2, rep.col="gray80", ...)

Arguments

b a fitted gam object as produced by gam().
old.style If you want old fashioned plots, exactly as in Wood, 2006, set to TRUE.
type type of residuals, see residuals.gam, used in all plots.
rep, level, rl.col, rep.col arguments passed to qq.gam() when old.style is false, see there.
... extra graphics parameters to pass to plotting functions.

Details

This function plots 4 standard diagnostic plots, and some other convergence diagnostics. Usually the 4 plots are various residual plots. The printed information relates to the optimization used to select smoothing parameters. For the default optimization methods the information is summarized in a readable way, but for other optimization methods, whatever is returned by way of convergence diagnostics is simply printed.

The QQ plot produced is usually created by a call to qq.gam, and plots deviance residuals against approximate theoretical quantilies of the deviance residual distribution, according to the fitted model. If this looks odd then investigate further using qq.gam. Note that residuals for models fitted to binary data contain very little information useful for model checking (it is necessary to find some way of aggregating them first), so the QQ plot is unlikely to be useful in this case.

Value

A vector of reference quantiles for the residual distribution, if these can be computed.

Author(s)

Simon N. Wood simon.wood@r-project.org

References

Wood S.N. (2006) Generalized Additive Models: An Introduction with R. Chapman and Hall/CRC Press.

http://www.maths.bath.ac.uk/~sw283/

See Also

choose.k, gam, mgcv, magic

Examples

library(mgcv)
set.seed(0)
dat <- gamSim(1,n=200)
b<-gam(y~s(x0)+s(x1)+s(x2)+s(x3),data=dat)
plot(b,pages=1)
gam.check(b,pch=19,cex=.3)

[Package mgcv version 1.7-6 Index]