Predictions from an nlme Object
Usage
predict(object, newdata, level, asList, na.action, naPattern)
Arguments
object
|
an object inheriting from class nlme , representing
a fitted nonlinear mixed-effects model.
|
newdata
|
an optional data frame to be used for obtaining the
predictions. All variables used in the nonlinear model, the fixed and
the random effects models, as well as the grouping factors, must be
present in the data frame. If missing, the fitted values are returned.
|
level
|
an optional integer vector giving the level(s) of grouping
to be used in obtaining the predictions. Level values increase from
outermost to innermost grouping, with level zero corresponding to the
population predictions. Defaults to the highest or innermost level of
grouping.
|
asList
|
an optional logical value. If TRUE and a single
value is given in level , the returned object is a list with
the predictions split by groups; else the returned value is
either a vector or a data frame, according to the length of
level .
|
na.action
|
a function that indicates what should happen when
newdata contains NA s. The default action
(na.fail ) causes the function to print an error message and
terminate if there are any incomplete observations.
|
naPattern
|
an expression or formula object, specifying which returned
values are to be regarded as missing.
|
Description
The predictions at level i are obtained by adding together the
contributions from the estimated fixed effects and the estimated
random effects at levels less or equal to i and evaluating the
model function at the resulting estimated parameters. If group values
not included in the original grouping factors are present in
newdata
, the corresponding predictions will be set to
NA
for levels greater or equal to the level at which the
unknown groups occur.Value
if a single level of grouping is specified in level
, the
returned value is either a list with the predictions split by groups
(asList = TRUE
) or a vector with the predictions
(asList = FALSE
); else, when multiple grouping levels are
specified in level
, the returned object is a data frame with
columns given by the predictions at different levels and the grouping
factors.Author(s)
Jose Pinheiro and Douglas BatesSee Also
nlme
, fitted.nlme
Examples
library(lme)
data(Soybean)
fm1 <- nlme(weight ~ SSlogis(Time, Asym, xmid, scal), data = Soybean,
fixed = Asym + xmid + scal ~ 1, start = c(18, 52, 7.5))
newSoybean <- data.frame(Time = c(10,30,50,80,100),
Plot = c("1988F1", "1988F1","1988F1", "1988F1","1988F1"))
predict(fm1, newSoybean, level = 0:1)