powered by
Obtains the model matrix from a fitted gam object.
gam
# S3 method for gam model.matrix(object, ...)
A model matrix.
fitted model object of class gam as produced by gam().
gam()
other arguments, passed to predict.gam.
predict.gam
Simon N. Wood simon.wood@r-project.org
Calls predict.gam with no newdata argument and type="lpmatrix" in order to obtain the model matrix of object.
newdata
type="lpmatrix"
object
Wood S.N. (2006b) Generalized Additive Models: An Introduction with R. Chapman and Hall/CRC Press.
require(mgcv) n <- 15 x <- runif(n) y <- sin(x*2*pi) + rnorm(n)*.2 mod <- gam(y~s(x,bs="cc",k=6),knots=list(x=seq(0,1,length=6))) model.matrix(mod)
Run the code above in your browser using DataLab