\HeaderA{augPred}{Augmented Predictions}{augPred}
\methaliasA{augPred.gls}{augPred}{augPred.gls}
\methaliasA{augPred.lme}{augPred}{augPred.lme}
\methaliasA{augPred.lmList}{augPred}{augPred.lmList}
\keyword{models}{augPred}
\begin{Description}\relax
Predicted values are obtained at the specified values of
\code{primary}. If \code{object} has a grouping structure
(i.e. \code{getGroups(object)} is not \code{NULL}), predicted values
are obtained for each group. If \code{level} has more than one
element, predictions are obtained for each level of the
\code{max(level)} grouping factor. If other covariates besides
\code{primary} are used in the prediction model, their average
(numeric covariates) or most frequent value (categorical covariates)
are used to obtain the predicted values. The original observations are
also included in the returned object.
\end{Description}
\begin{Usage}
\begin{verbatim}
augPred(object, primary, minimum, maximum, length.out, ...)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{object}] a fitted model object from which predictions can be
extracted, using a \code{predict} method.
\item[\code{primary}] an optional one-sided formula specifying the primary
covariate to be used to generate the augmented predictions. By
default, if a  covariate can be extracted from the data used to generate
\code{object} (using \code{getCovariate}), it will be used as
\code{primary}.
\item[\code{minimum}] an optional lower limit for the primary
covariate. Defaults to \code{min(primary)}.
\item[\code{maximum}] an optional upper limit for the primary
covariate. Defaults to \code{max(primary)}.
\item[\code{length.out}] an optional integer with the number of primary
covariate values at which to evaluate the predictions. Defaults to
51.
\item[\code{...}] some methods for the generic may require additional
arguments.
\end{ldescription}
\end{Arguments}
\begin{Value}
a data frame with four columns representing, respectively, the values
of the primary covariate, the groups (if \code{object} does not have a
grouping structure, all elements will be \code{1}), the predicted or
observed values, and the type of value in the third column:
\code{original} for the observed values and \code{predicted} (single
or no grouping factor) or \code{predict.groupVar} (multiple levels of
grouping), with \code{groupVar} replaced by the actual grouping
variable name (\code{fixed} is used for population predictions). The
returned object inherits from class \code{augPred}.
\end{Value}
\begin{Note}\relax
This function is generic; method functions can be written to handle
specific classes of objects. Classes which already have methods for
this function include: \code{gls}, \code{lme}, and \code{lmList}.
\end{Note}
\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{\LinkA{plot.augPred}{plot.augPred}}, \code{\LinkA{getGroups}{getGroups}},
\code{\LinkA{predict}{predict}}
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
fm1 <- lme(Orthodont, random = ~1)
augPred(fm1, length.out = 2, level = c(0,1))
\end{ExampleCode}
\end{Examples}

