get.models {MuMIn} | R Documentation |
Retrieve models from selection table
Description
Generate or extract a list of fitted model objects from a
"model.selection"
table, optionally using parallel computation in a
cluster.
Usage
get.models(object, subset, cluster = NA, ...)
Arguments
object |
object returned by |
subset |
subset of models, an expression evaluated within the model selection table (see ‘Details’). |
cluster |
optionally, a |
... |
additional arguments to update the models. For example, in
|
Details
The argument subset
must be explicitely provided. This is to assure that
a potentially long list of models is not fitted unintentionally. To evaluate all
models, set subset
to NA
or TRUE
.
If subset
is a character vector, it is interpreted as names of rows to be
selected.
Value
list
of fitted model objects.
Note
Alternatively, getCall
and eval
can be used to compute a model out of the
"model.selection"
table (e.g. eval(getCall(<model.selection>, i))
, where
i
is the model index or name).
Using get.models
following dredge
is not efficient as the requested models
have to be fitted again. If the number of generated models is reasonable, consider using
lapply(dredge(..., evaluate = FALSE), eval)
, which generates a list of all model
calls and evaluates them into a list of model objects. This avoids fitting the
models twice.
pget.models
is still available, but is deprecated.
Author(s)
Kamil BartoĊ
See Also
makeCluster
in packages parallel and snow
Examples
# Mixed models:
fm2 <- lme(distance ~ age + Sex, data = Orthodont,
random = ~ 1 | Subject, method = "ML")
ms2 <- dredge(fm2)
# Get top-most models, but fitted by REML:
(confset.d4 <- get.models(ms2, subset = delta < 4, method = "REML"))
## Not run:
# Get the top model:
get.models(ms2, subset = 1)[[1]]
## End(Not run)