Models are fitted one by one through repeated evaluation of modified calls to
the global.model
(in a similar fashion as with update
). This
approach, while robust in that it can be applied to a variety of different model
object types is not very efficient and may be time-intensive.Note that the number of combinations grows exponentially with number of
predictor variables (latex{$2^{N}$}{2^N}, less when interactions
are present, see below). As there can be potentially a large number of models to
evaluate, to avoid memory overflow the fitted model objects are not stored in
the result. To get (a subset of) the models, use get.models
on the
object returned by dredge
.
For a list of model types that can be used as a global.model
see
list of supported models.
Modelling functions not storing call
in their result should be evaluated
via the wrapper created by updateable
.
Information criterion{
rank
is found by a call to match.fun
and may be specified as a
function or a symbol (e.g. a back-quoted name) or a character string specifying
a function to be searched for from the environment of the call to dredge
.
The function rank
must accept model object as its first argument and
always return a scalar. Typical choice for rank
would be "AIC", "BIC", or
"QAIC".
}
Interactions{
dredge
by default respects marginality
constraints, so all possible combinations do not include models
containing interactions without their respective main effects and all lower order
terms. This behaviour can be altered by marg.ex
argument, which can be used
to allow for simple nested designs. For example, with global model of form
a / (x + z)
, one would use marg.ex = "a"
and fixed = "a"
.
If global.model
uses such a formula and marg.ex
is missing or
NA
, it will be adjusted automatically.
}
Subsetting{
There are three ways to constrain the resulting set of models: setting limits to
the number of terms in a model with m.max
and m.min
, binding
term(s) to all models with fixed
, and more complex rules can be applied
using argument subset
. To be included in the selection table, the model
formulation must satisfy all these conditions.
subset
can take either a form of an expression or a matrix.
The latter should be a lower triangular matrix with logical values, where
columns and rows correspond to global.model
terms. Value
subset["a", "b"] == FALSE
will exclude any model containing both a
and b. Values other than FALSE
(or 0
) are taken as
TRUE
.
In the form of expression
, the argument subset
acts in a similar
fashion to that in the function subset
for data.frames
: model
terms can be referred to by name as variables in the expression, with the
difference being that they are always logical (i.e. TRUE
if a term exists
in the model).
The expression can contain any of the global.model
terms
(getAllTerms(global.model)
lists them), as well as names of the
varying
argument items. Names of global.model
terms take
precedence when identical to names of varying
, so to avoid ambiguity
varying
variables in subset
expression should be enclosed in
V()
(e.g. subset = V(family) == "Gamma"
assuming that
varying
is something like list(family = c(..., "Gamma"))
).
If element names in varying
are missing, the elements themselves are
used. Call and symbol elements are represented as character values (via
deparse
), and everything except numeric, logical, character and
NULL
values is replaced by item numbers (e.g. varying =
list(family = list(..., Gamma)
should be referred to as subset =
V(family) == 2
. This can quickly become confusing, therefore it is recommended
to use named lists in most cases. demo(dredge.varying)
provides examples.
The subset
expression can also contain variable `*nvar*`
(needs to
be backtick-quoted), which is equal to number of terms in the model (not
the number of estimated parameters K).
To make inclusion of a variable conditional on presence of some other variable,
a function dc
(dependency chain) can be used in
the subset
expression. dc
takes any number of variables as
arguments, and allows a variable to be included only if all preceding variables
are also present (e.g. subset = dc(a, b, c)
allows for models of form
a
, a+b
and a+b+c
but not b
, c
, b+c
or
a+c
).
subset
expression can have a form of an unevaluated call
,
expression
object, or a one sided formula
. See Examples.
Compound model terms (such as as-is expressions within I()
or
smooths in gam
) should be treated as non-syntactic names and enclosed in
back-ticks (e.g. subset = `s(x, k = 2)` || `I(log(x))`
, see
Quotes). Mind the spacing, names must match exactly the term names
in model's formula. To simply keep certain terms in all models, use of argument
fixed
is more efficient.
subset
expression syntax summary{
ll{
a & b
indicates that variables a and b must be
present (see Logical Operators)
V(x)
indicates a varying
variable x
dc(a,b,c,...)
dependency chain: a is allowed only
if b is present, and b only if c is present, etc.
`*nvar*`
number of variables
}
}
}
Missing values{
Use of na.action = na.omit
(R's default) in global.model
should
be avoided, as it results with sub-models fitted to different data sets, if
there are missing values. Warning is given if it is detected.
}
Methods{
There are subset
and plot
methods,
the latter produces a graphical representation of model weights and variable
relative importance.
Coefficients can be extracted with coef
or coefTable
.
}