Rev 6562 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed
% File nlme/man/comparePred.Rd% Part of the nlme package for R% Distributed under GPL 2 or later: see nlme/LICENCE.note\name{comparePred}\title{Compare Predictions}\usage{comparePred(object1, object2, primary, minimum, maximum,length.out, level, \dots)}\alias{comparePred}\alias{comparePred.gls}\alias{comparePred.lme}\alias{comparePred.lmList}\arguments{\item{object1,object2}{fitted model objects, from which predictions canbe extracted using the \code{predict} method.}\item{primary}{an optional one-sided formula specifying the primarycovariate to be used to generate the augmented predictions. Bydefault, if a covariate can be extracted from the data used to generatethe objects (using \code{getCovariate}), it will be used as\code{primary}.}\item{minimum}{an optional lower limit for the primarycovariate. Defaults to \code{min(primary)}, after \code{primary} isevaluated in the \code{data} used in fitting \code{object1}.}\item{maximum}{an optional upper limit for the primarycovariate. Defaults to \code{max(primary)}, after \code{primary} isevaluated in the \code{data} used in fitting \code{object1}.}\item{length.out}{an optional integer with the number of primarycovariate values at which to evaluate the predictions. Defaults to51.}\item{level}{an optional integer specifying the desiredprediction level. Levels increase from outermost to innermostgrouping, with level 0 representing the population (fixed effects)predictions. Only one level can be specified. Defaults to theinnermost level.}\item{\dots}{some methods for the generic may require additionalarguments.}}\description{Predicted values are obtained at the specified values of\code{primary} for each object. If either \code{object1} or\code{object2} have a grouping structure(i.e. \code{getGroups(object)} is not \code{NULL}), predicted valuesare obtained for each group. When both objects determine groups, thegroup levels must be the same. If other covariates besides\code{primary} are used in the prediction model, their group-wise averages(numeric covariates) or most frequent values (categorical covariates)are used to obtain the predicted values. The original observations arealso included in the returned object.}\value{a data frame with four columns representing, respectively, the valuesof the primary covariate, the groups (if \code{object} does not have agrouping structure, all elements will be \code{1}), the predicted orobserved values, and the type of value in the third column: theobjects' names are used to classify the predicted values and\code{original} is used for the observed values. The returned objectinherits from classes \code{comparePred} and \code{augPred}.}\author{José Pinheiro and Douglas Bates \email{bates@stat.wisc.edu}}\note{This function is generic; method functions can be written to handlespecific classes of objects. Classes which already have methods forthis function include: \code{gls}, \code{lme}, and \code{lmList}.}\seealso{\code{\link{augPred}}, \code{\link{getGroups}}}\examples{fm1 <- lme(distance ~ age * Sex, data = Orthodont, random = ~ age)fm2 <- update(fm1, distance ~ age)comparePred(fm1, fm2, length.out = 2)}\keyword{models}