Learn R Programming

MuMIn (version 1.9.5)

subset.model.selection: Subsetting model selection table

Description

Return subsets of a model selection table returned by dredge or model.sel.

Usage

## S3 method for class 'model.selection':
subset(x, subset, select, recalc.weights = TRUE,
	recalc.delta = FALSE, ...)
## S3 method for class 'model.selection':
[(x, i, j, recalc.weights = TRUE, recalc.delta = FALSE, ...)

Arguments

x
a model.selection object to be subsetted.
subset,select
logical expressions indicating columns and rows to keep. See subset.
i,j
indices specifying elements to extract.
recalc.weights
logical value specyfying whether Akaike weights should be normalized across the new set of models to sum to one.
recalc.delta
logical value specyfying whether $delta[IC]$ should be calculated for the new set of models (this is not done by default).
...
further arguments passed to [.data.frame.

Value

  • A model.selection object containing only the selected models (rows). When columns are selected (arguments select or j are provided), a plain data.frame is returned.

encoding

utf-8

See Also

dredge, subset and [.data.frame for subsetting and extracting from data.frames.

Examples

Run this code
data(Cement)
fm1 <- lm(formula = y ~ X1 + X2 + X3 + X4, data = Cement)

# generate models where each variable is included only if the previous
# are included too, e.g. X2 only if X1 is there, and X3 only if X2 and X1
dredge(fm1, subset = dc(X1, X2, X3, X4))

# which is equivalent to
# dredge(fm1, subset = (!X2 | X1) & (!X3 | X2) & (!X4 | X3))

# alternatively, generate "all possible" combinations
ms0 <- dredge(fm1)
# ...and afterwards select the subset of models
subset(ms0, dc(X1, X2, X3, X4))
# which is equivalent to
# subset(ms0, (has(!X2) | has(X1)) & (has(!X3) | has(X2)) & (has(!X4) | has(X3)))

# Different ways of finding a confidence set of models:
# delta(AIC) cutoff
subset(ms0, delta <= 4, recalc.weights = FALSE)
# cumulative sum of Akaike weights
subset(ms0, cumsum(weight) <= .95, recalc.weights = FALSE)
# relative likelihood
subset(ms0, (weight / weight[1]) > (1/8), recalc.weights = FALSE)

Run the code above in your browser using DataLab