nested | R Documentation |
Find models that are ‘nested’ within each model in the model selection table.
nested(x, indices = c("none", "numeric", "rownames"), rank = NULL)
x |
a |
indices |
if omitted or |
rank |
the name of the column with the ranking values (defaults to
the one before “delta”). Only used if |
In model comparison, a model is said to be “nested” within another model if it contains a subset of parameters of the latter model, but does not include other parameters (e.g. model ‘A+B’ is nested within ‘A+B+C’ but not ‘A+C+D’).
This function can be useful in a model selection approach suggested by Richards (2008), in which more complex variants of any model with a lower IC value are excluded from the candidate set.
A vector of length equal to the number of models (table rows).
If indices = "none"
(the default), it is a vector of logical
values where i-th element is TRUE
if any model(s) higher up in
the table are nested within it (i.e. if simpler models have lower IC pointed
by rank
).
For indices
other than "none"
, the function returns a list of
vectors of numeric indices or names of models nested within each
i-th model.
This function determines nesting based only on fixed model terms, within groups of
models sharing the same ‘varying’ parameters (see dredge
and
example in Beetle
).
Kamil Bartoń
Richards, S. A., Whittingham, M. J., Stephens, P. A. 2011 Model selection and model averaging in behavioural ecology: the utility of the IT-AIC framework. Behavioral Ecology and Sociobiology 65, 77–89.
Richards, S. A. 2008 Dealing with overdispersed count data in applied ecology. Journal of Applied Ecology 45, 218–227.
dredge
, model.sel
fm <- lm(y ~ X1 + X2 + X3 + X4, data = Cement, na.action = na.fail)
ms <- dredge(fm)
# filter out overly complex models according to the
# "nesting selection rule":
subset(ms, !nested(.)) # dot represents the ms table object
# print model "4" and all models nested within it
nst <- nested(ms, indices = "row")
ms[c("4", nst[["4"]])]
ms$nested <- sapply(nst, paste, collapse = ",")
ms
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.