Rev 6562 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed
% File nlme/man/predict.lme.Rd% Part of the nlme package for R% Distributed under GPL 2 or later: see nlme/LICENCE.note\name{predict.lme}\title{Predictions from an lme Object}\usage{\method{predict}{lme}(object, newdata, level = Q, asList = FALSE,na.action = na.fail, \dots)}\alias{predict.lme}\arguments{\item{object}{an object inheriting from class \code{"\link{lme}"}, representinga fitted linear mixed-effects model.}\item{newdata}{an optional data frame to be used for obtaining thepredictions. All variables used in the fixed and random effectsmodels, as well as the grouping factors, must be present in the dataframe. If missing, the fitted values are returned.}\item{level}{an optional integer vector giving the level(s) of groupingto be used in obtaining the predictions. Level values increase fromoutermost to innermost grouping, with level zero corresponding to thepopulation predictions. Defaults to the highest or innermost level ofgrouping.}\item{asList}{an optional logical value. If \code{TRUE} and a singlevalue is given in \code{level}, the returned object is a list withthe predictions split by groups; else the returned value iseither a vector or a data frame, according to the length of\code{level}. }\item{na.action}{a function that indicates what should happen when\code{newdata} contains \code{NA}s. The default action(\code{na.fail}) causes the function to print an error message andterminate if there are any incomplete observations.}\item{\dots}{some methods for this generic require additionalarguments. None are used in this method.}}\description{The predictions at level \eqn{i} are obtained by adding together thepopulation predictions (based only on the fixed effects estimates)and the estimated contributions of the random effects to thepredictions at grouping levels less or equal to \eqn{i}. The resultingvalues estimate the best linear unbiased predictions (BLUPs) at level\eqn{i}. If group values not included in the original grouping factorsare present in \code{newdata}, the corresponding predictions will beset to \code{NA} for levels greater or equal to the level at which theunknown groups occur.}\value{if a single level of grouping is specified in \code{level}, thereturned value is either a list with the predictions split by groups(\code{asList = TRUE}) or a vector with the predictions(\code{asList = FALSE}); else, when multiple grouping levels arespecified in \code{level}, the returned object is a data frame withcolumns given by the predictions at different levels and the groupingfactors.}\author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}}\seealso{\code{\link{lme}}, \code{\link{fitted.lme}}}\examples{fm1 <- lme(distance ~ age, Orthodont, random = ~ age | Subject)newOrth <- data.frame(Sex = c("Male","Male","Female","Female","Male","Male"),age = c(15, 20, 10, 12, 2, 4),Subject = c("M01","M01","F30","F30","M04","M04"))## The 'Orthodont' data has *no* 'F30', so predict NA at level 1 :predict(fm1, newOrth, level = 0:1)}\keyword{models}