predict.averaging.Rd
Model-averaged predictions, optionally with standard errors.
# S3 method for class 'averaging'
predict(object, newdata = NULL, se.fit = FALSE,
interval = NULL, type = NA, backtransform = FALSE, full = TRUE, ...)
an object returned by model.avg
.
optional data.frame
in which to look for variables
with which to predict. If omitted, the fitted values are used.
logical, indicates if standard errors should be returned.
This has any effect only if the predict
methods for each of the
component models support it.
currently not used.
the type of predictions to return (see documentation for
predict
appropriate for the class of used component models). If
omitted, the default type is used. See ‘Details’.
if TRUE
, the averaged predictions are
back-transformed from link scale to response scale. This makes sense
provided that all component models use the same family
, and the
prediction from each of the component models is calculated on the link
scale (as specified by type
. For glm
, use type =
"link"
).
See ‘Details’.
if TRUE
, the full model-averaged coefficients are used
(only if se.fit = FALSE
and the component objects are a result of
lm
).
arguments to be passed to respective predict
method (e.g. level
for lmenlme model).
If se.fit = FALSE
, a vector of predictions, otherwise a list
with components: fit
containing the predictions, and se.fit
with
the estimated standard errors.
predict
ing is possible only with averaging
objects with
"modelList"
attribute, i.e. those created via model.avg
from a model list, or from model.selection
object with argument fit
= TRUE
(which will recreate the model objects, see model.avg).
If all the component models are ordinary linear models, the prediction can be
made either with the full averaged coefficients (the argument full =
TRUE
this is the default) or subset-averaged coefficients. Otherwise the
prediction is obtained by calling predict
on each component model and
weighted averaging the results, which corresponds to the assumption that all
predictors are present in all models, but those not estimated are equal zero
(see ‘Note’ in model.avg). Predictions from component models
with standard errors are passed to par.avg
and averaged in the same way
as the coefficients are.
Predictions on the response scale from generalized models can be calculated by
averaging predictions of each model on the link scale, followed by inverse
transformation (this is achieved with type = "link"
and
backtransform = TRUE
). This is only possible if all component models use
the same family and link function. Alternatively, predictions from each model on
response scale may be averaged (with type = "response"
and
backtransform = FALSE
). Note that this leads to results differing from
those calculated with the former method. See also
predict.glmstats.
This method relies on availability of the predict
methods for the
component model classes (except when all component models are of class
lm
).
The package MuMIn includes predict
methods for lme
,
and gls
that calculate standard errors of the predictions
(with se.fit = TRUE
). They enhance the original predict methods from
package nlme, and with se.fit = FALSE
they return identical result.
MuMIn's versions are always used in averaged model predictions (so it is
possible to predict with standard errors), but from within global environment
they will be found only if MuMIn is before nlme on the
search list (or directly extracted from namespace as
MuMIn:::predict.lme
).
model.avg, and par.avg for details of model-averaged parameter calculation.
predict.lmenlme, predict.glsnlme