model.sel.Rd
Build a model selection table.
model.sel(object, ...)
# Default S3 method
model.sel(object, ..., rank = NULL, rank.args = NULL,
beta = c("none", "sd", "partial.sd"), extra)
# S3 method for class 'model.selection'
model.sel(object, rank = NULL, rank.args = NULL, fit = NA,
..., beta = c("none", "sd", "partial.sd"), extra)
model.sel(x) <- value
a fitted model object, a list of such objects, or a
"model.selection"
object.
more fitted model objects.
optional, custom rank function (returning an information
criterion) to use instead of the default AICc
, e.g. QAIC
or BIC
, may be omitted
if object
is a model list returned by get.models
.
optional list
of arguments for the rank
function. If one is an expression, an x
within it is substituted
with a current model.
logical, stating whether the model objects should be re-fitted if
they are not stored in the "model.selection"
object. Set to
NA
to re-fit the models only if this is needed.
See ‘Details’.
indicates whether and how the component models' coefficients
should be standardized. See the argument's description in
dredge
.
optional additional statistics to include in the result,
provided as functions, function names or a list of such (best if named
or quoted). See dredge
for details.
a "model.selection"
object.
An object of class c("model.selection", "data.frame")
, being a
data.frame
, where each row represents one model and columns contain
useful information about each model: the coefficients, df, log-likelihood, the
value of the information criterion used,
Δ_IC and ‘Akaike
weight’.
If any arguments differ between the modelling function calls, the
result will include additional columns showing them (except for formulas and
some other arguments).
See model.selection.object
for its structure.
model.sel
used with "model.selection"
object will re-fit model
objects, unless they are stored in object
(in attribute "modelList"
),
if argument extra
is provided, or the requested beta
is different
than object's "beta"
attribute, or the new rank
function
cannot be applied directly to logLik
objects, or new rank.args
are given (unless argument fit = FALSE
).
The replacement function appends new models to the existing "model.selection"
object.
dredge
, AICc
, list of supported
models.
Possible alternatives: ICtab
(in package bbmle), or
aictab
(AICcmodavg).
Cement$X1 <- cut(Cement$X1, 3)
Cement$X2 <- cut(Cement$X2, 2)
fm1 <- glm(formula = y ~ X1 + X2 * X3, data = Cement)
fm2 <- update(fm1, . ~ . - X1 - X2)
fm3 <- update(fm1, . ~ . - X2 - X3)
## ranked with AICc by default
(msAICc <- model.sel(fm1, fm2, fm3))
#> Model selection table
#> (Int) X1 X2 X3 X2:X3 df logLik AICc delta weight
#> fm3 83.25 + + 6 -39.584 105.2 0.00 0.558
#> fm1 75.79 + + 0.07826 + 7 -34.924 106.2 1.08 0.325
#> fm2 104.70 -1.39800 + 4 -47.653 108.3 3.14 0.116
#> Models ranked by AICc(x)
## ranked with BIC
model.sel(fm1, fm2, fm3, rank = AIC, rank.args = alist(k = log(nobs(x))))
#> Model selection table
#> (Int) X1 X2 X3 X2:X3 df logLik AIC delta weight
#> fm1 75.79 + + 0.07826 + 7 -34.924 87.8 0.00 0.967
#> fm3 83.25 + + 6 -39.584 94.6 6.75 0.033
#> fm2 104.70 -1.39800 + 4 -47.653 105.6 17.76 0.000
#> Models ranked by AIC(x, k = log(nobs(x)))
# or
# model.sel(msAICc, rank = AIC, rank.args = alist(k = log(nobs(x))))
# or
# update(msAICc, rank = AIC, rank.args = alist(k = log(nobs(x))))
# appending new models:
model.sel(msAICc) <- update(fm1, . ~ 1)