\HeaderA{Predict.matrix}{Prediction methods for smooth terms in a GAM}{Predict.matrix}
\aliasA{Predict.matrix.cpspline.smooth}{Predict.matrix}{Predict.matrix.cpspline.smooth}
\aliasA{Predict.matrix.cr.smooth}{Predict.matrix}{Predict.matrix.cr.smooth}
\aliasA{Predict.matrix.cs.smooth}{Predict.matrix}{Predict.matrix.cs.smooth}
\aliasA{Predict.matrix.cyclic.smooth}{Predict.matrix}{Predict.matrix.cyclic.smooth}
\aliasA{Predict.matrix.pspline.smooth}{Predict.matrix}{Predict.matrix.pspline.smooth}
\aliasA{Predict.matrix.tensor.smooth}{Predict.matrix}{Predict.matrix.tensor.smooth}
\aliasA{Predict.matrix.tprs.smooth}{Predict.matrix}{Predict.matrix.tprs.smooth}
\aliasA{Predict.matrix.ts.smooth}{Predict.matrix}{Predict.matrix.ts.smooth}
\aliasA{Predict.matrix2}{Predict.matrix}{Predict.matrix2}
\keyword{models}{Predict.matrix}
\keyword{smooth}{Predict.matrix}
\keyword{regression}{Predict.matrix}
\begin{Description}\relax
Takes \code{smooth} objects produced by \code{smooth.construct} methods and obtains the matrix mapping 
the parameters associated with such a smooth to the predicted values of the smooth at a set of new covariate values.

In practice this method is often called via the wrapper function \code{\LinkA{PredictMat}{PredictMat}}.
\end{Description}
\begin{Usage}
\begin{verbatim}
Predict.matrix(object,data)
Predict.matrix2(object,data)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{object}] is a smooth object produced by a \code{smooth.construct} method function. The object 
contains all the information required to specify the basis for a term of its class, and this information is
used by the appropriate \code{Predict.matrix} function to produce a prediction matrix for new covariate values.
Further details are given in \code{\LinkA{smooth.construct}{smooth.construct}}.
\item[\code{data}] A data frame containing the values of the (named) covariates at which the smooth term is to be 
evaluated. Exact requirements are as for \code{\LinkA{smooth.construct}{smooth.construct}} and \code{smooth.construct2}
\end{ldescription}
.
\end{Arguments}
\begin{Details}\relax
Smooth terms in a GAM formula are turned into smooth specification objects of 
class \code{xx.smooth.spec} during processing of the formula. Each of these objects is
converted to a smooth object using an appropriate \code{smooth.construct} function. The \code{Predict.matrix} 
functions are used to obtain the matrix that will map the parameters associated with a smooth term to
the predicted values for the term at new covariate values.

Note that new smooth classes can be added by writing a new \code{smooth.construct} method function and a 
corresponding \code{\LinkA{Predict.matrix}{Predict.matrix}} method function: see the example code provided for 
\code{\LinkA{smooth.construct}{smooth.construct}} for details.
\end{Details}
\begin{Value}
A matrix which will map the parameters associated with the smooth to the vector of values of the smooth 
evaluated at the covariate values given in \code{object}. If the smooth class
is one which generates offsets the corresponding offset is returned as
attribute \code{"offset"} of the matrix.
\end{Value}
\begin{Author}\relax
Simon N. Wood \email{simon.wood@r-project.org}
\end{Author}
\begin{References}\relax
Wood S.N. (2006) Generalized Additive Models: An Introduction with R. Chapman
and Hall/CRC Press.
\end{References}
\begin{SeeAlso}\relax
\code{\LinkA{gam}{gam}},\code{\LinkA{gamm}{gamm}},
\code{\LinkA{smooth.construct}{smooth.construct}}, \code{\LinkA{PredictMat}{PredictMat}}
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}# See smooth.construct examples
\end{ExampleCode}
\end{Examples}

