\HeaderA{model.matrix.gam}{Extract model matrix from GAM fit}{model.matrix.gam}
\keyword{models}{model.matrix.gam}
\keyword{smooth}{model.matrix.gam}
\keyword{regression}{model.matrix.gam}
\begin{Description}\relax
Obtains the model matrix from a fitted \code{gam} object.
\end{Description}
\begin{Usage}
\begin{verbatim}
## S3 method for class 'gam':
model.matrix(object, ...)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{object}] fitted model object of class \code{gam} as produced by \code{gam()}.
\item[\code{...}] other arguments, passed to \code{\LinkA{predict.gam}{predict.gam}}.
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
Calls \code{\LinkA{predict.gam}{predict.gam}} with no \code{newdata} argument and
\code{type="lpmatrix"} in order to obtain the model matrix of \code{object}.
\end{Details}
\begin{Value}
A model matrix.
\end{Value}
\begin{Author}\relax
Simon N. Wood \email{simon.wood@r-project.org}
\end{Author}
\begin{References}\relax
Wood S.N. (2006b) Generalized Additive Models: An Introduction with R. Chapman
and Hall/CRC Press.
\end{References}
\begin{SeeAlso}\relax
\code{\LinkA{gam}{gam}}
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode} 
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)
\end{ExampleCode}
\end{Examples}

