\Header{model.matrix.reStruct}{reStruct Model Matrix}
\keyword{models}{model.matrix.reStruct}
\begin{Description}\relax
The model matrices for each element of \code{formula(object)},
calculated using \code{data}, are bound together column-wise. When
multiple grouping levels are present (i.e. when \code{length(object) >
    1}), the individual model matrices are combined from innermost (at
the leftmost position) to outermost (at the rightmost position).\end{Description}
\begin{Usage}
\begin{verbatim}
## S3 method for class 'reStruct':
model.matrix(object, data, contrast, ...)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{object}] an object inheriting from class \code{reStruct},
representing a random effects structure and consisting of a list of
\code{pdMat} objects.
\item[\code{data}] a data frame in which to evaluate the variables defined in
\code{formula(object)}.
\item[\code{contrast}] an optional named list specifying the contrasts to be used
for representing the \code{factor} variables in \code{data}. The
components names should match the names of the variables in
\code{data} for which the contrasts are to be specified. The
components of this list will be used as the \code{contrasts}
attribute of the corresponding factor. If missing, the default
contrast specification is used.
\item[\code{...}] some methods for this generic require additional
arguments.  None are used in this method.
\end{ldescription}
\end{Arguments}
\begin{Value}
a matrix obtained by binding together, column-wise, the model matrices
for each element of \code{formula(object)}.\end{Value}
\begin{Author}\relax
Jose Pinheiro \email{Jose.Pinheiro@pharma.novartis.com} and Douglas Bates \email{bates@stat.wisc.edu}\end{Author}
\begin{SeeAlso}\relax
\code{\Link{model.matrix}}, \code{\Link{contrasts}},
\code{\Link{reStruct}}, \code{\Link{formula.reStruct}}\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
data(Pixel)
rs1 <- reStruct(list(Dog = ~day, Side = ~1), data = Pixel)
model.matrix(rs1, Pixel)
\end{ExampleCode}
\end{Examples}

