Description Usage Arguments Details Value Note Author(s) References See Also Examples
Model averaging based on an information criterion.
1 2 3 4 5 6 7 8 9  model.avg(object, ..., revised.var = TRUE)
## Default S3 method:
model.avg(object, ..., beta = c("none", "sd", "partial.sd"),
rank = NULL, rank.args = NULL, revised.var = TRUE,
dispersion = NULL, ct.args = NULL)
## S3 method for class 'model.selection'
model.avg(object, subset, fit = FALSE, ..., revised.var = TRUE)

object 
a fitted model object or a list of such objects, or a

... 
for default method, more fitted model objects. Otherwise, arguments that are passed to the default method. 
beta 
indicates whether and how the component models' coefficients
should be standardized. See the argument's description in

rank 
optionally, a rank function (returning an information criterion) to
use instead of 
rank.args 
optional 
revised.var 
logical, indicating whether to use revised formula for
standard errors. See 
dispersion 
the dispersion parameter for the family used. See

ct.args 
optional list of arguments to be passed to

subset 
see 
fit 
if 
model.avg
may be used either with a list of models, or directly with a
model.selection
object (e.g. returned by dredge
). In the
latter case, the models from the model selection table are not evaluated
unless the argument fit
is set to TRUE
or some additional
arguments are present (such as rank
or dispersion
). This
results in much faster calculation, but has certain drawbacks, because the
fitted component model objects are not stored, and some methods (e.g.
predict
, fitted
, model.matrix
or vcov
) would not
be available with the returned object. Otherwise, get.models
is
called prior to averaging, and ... are passed to it.
For a list of model types that are accepted see list of supported models.
rank
is found by a call to match.fun
and typically is
specified as a function or a symbol or a character string specifying a
function to be searched for from the environment of the call to lapply.
rank
must be a function able to accept model as a first argument and
must always return a numeric scalar.
Several standard methods for fitted model objects exist for class
averaging
, including summary
,
predict
, coef
, confint
,
formula
, and vcov
.
coef
, vcov
, confint
and coefTable
accept argument
full
that if set to TRUE
, the full modelaveraged coefficients
are returned, rather than subsetaveraged ones (when full = FALSE
,
being the default).
logLik
returns a list of logLik
objects
for the component models.
An object of class "averaging"
is a list with components:
msTable 
a 
coefficients 
a 
coefArray 
a 3dimensional 
importance 
object of class 
formula 
a formula corresponding to the one that would be used in a single model. The formula contains only the averaged (fixed) coefficients. 
call 
the matched call. 
The object has following attributes:
rank 
the rank function used. 
modelList 
optionally, a list of all component model objects. Only if the object was created with model objects (and not model selection table). 
beta 
Corresponds to the function argument. 
nobs 
number of observations. 
revised.var 
Corresponds to the function argument. 
The ‘subset’ (or ‘conditional’) average only averages over the models where the parameter appears. An alternative, the ‘full’ average assumes that a variable is included in every model, but in some models the corresponding coefficient (and its respective variance) is set to zero. Unlike the ‘subset average’, it does not have a tendency of biasing the value away from zero. The ‘full’ average is a type of shrinkage estimator and for variables with a weak relationship to the response they are smaller than ‘subset’ estimators.
Averaging models with different contrasts for the same factor would yield nonsense results, currently no checking for contrast consistency is done.
print
method provides a concise output (similarly as for lm
).
To print more details use summary
function, and confint
to get confidence intervals.
Kamil Bartoń
Burnham, K. P. and Anderson, D. R. (2002) Model selection and multimodel inference: a practical informationtheoretic approach. 2nd ed. New York, SpringerVerlag.
Lukacs, P. M., Burnham K. P. and Anderson, D. R. (2009) Model selection bias and Freedman’s paradox. Annals of the Institute of Statistical Mathematics 62(1): 117–125.
See par.avg
for more details of model averaged parameter
calculation.
dredge
, get.models
AICc
has examples of averaging models fitted by REML.
modavg
in package AICcmodavg, and
coef.glmulti
in package glmulti also perform model
averaging.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34  # Example from Burnham and Anderson (2002), page 100:
fm1 < lm(y ~ ., data = Cement, na.action = na.fail)
(ms1 < dredge(fm1))
#models with delta.aicc < 4
summary(model.avg(ms1, subset = delta < 4))
#or as a 95% confidence set:
avgmod.95p < model.avg(ms1, cumsum(weight) <= .95)
confint(avgmod.95p)
## Not run:
# The same result, but refitting the models via 'get.models'
confset.95p < get.models(ms1, cumsum(weight) <= .95)
model.avg(confset.95p)
# Force refitting the component models
model.avg(ms1, cumsum(weight) <= .95, fit = TRUE)
# Models are also fitted if additional arguments are given
model.avg(ms1, cumsum(weight) <= .95, rank = "AIC")
## End(Not run)
## Not run:
# using BIC (Schwarz's Bayesian criterion) to rank the models
BIC < function(x) AIC(x, k = log(length(residuals(x))))
model.avg(confset.95p, rank = BIC)
# the same result, using AIC directly, with argument k
# 'x' in a quoted 'rank' argument is substituted with a model object
# (in this case it does not make much sense as the number of observations is
# common to all models)
model.avg(confset.95p, rank = AIC, rank.args = alist(k = log(length(residuals(x)))))
## End(Not run)

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.