mgcv (version 0.1-1)

plot.gam: Default GAM plotting

Description

Takes a fitted gam object prodced by gam() and plots the component smooth functions that make it up on the scale of the linear predictor.

Usage

plot.gam(object,rug,se,pages,scale,n)

Arguments

object
a fitted gam object as produced by gam().
rug
when TRUE (default) then the covariate to which the plot applies is displayed as a rug plot at the foot of each plot.

Value

  • The function simply generates plots.

item

  • se
  • pages
  • scale
  • n

WARNING

Note that the behaviour of this function is not identical to plot.gam() in Splus.

Details

Produces default plot showing the smooth components of a fitted GAM. The x axis of eaxh plot is labelled with the covariate name, while the y axis is labelled s(cov,edf) where cov is the covariate name, and edf the estimated degrees of freedom of the smooth. Within the function, the data for the plots is obtained by a call to predict.gam() with a suitably constructed data frame.

References

Gu and Wahba (1991) Minimizing GCV/GML scores with multiple smoothing parameters via the Newton method. SIAM J. Sci. Statist. Comput. 12:383-398

Wood (2000) Modelling and Smoothing Parameter Estimation with Multiple Quadratic Penalties. JRSSB 62(2)

http://www.ruwpa.st-and.ac.uk/simon.html

See Also

gam predict.gam

Examples

Run this code
library(mgcv)
n<-200
sig2<-4
x0 <- runif(n, 0, 1)
x1 <- runif(n, 0, 1)
x2 <- runif(n, 0, 1)
x3 <- runif(n, 0, 1)
pi <- asin(1) * 2
y <- 2 * sin(pi * x0)
y <- y + exp(2 * x1) - 3.75887
y <- y + 0.2 * x2^11 * (10 * (1 - x2))^6 + 10 * (10 * x2)^3 * (1 - x2)^10 - 1.396
e <- rnorm(n, 0, sqrt(abs(sig2)))
y <- y + e
b<-gam(y~s(x0)+s(x1)+s(x2)+s(x3))
plot(b)

Run the code above in your browser using DataCamp Workspace