Description Usage Arguments Details Value Author(s) References See Also Examples
Evaluates all models in a set of candidates, and ranks them by IC such as AIC. Either lm or lme can be used for the model.
1 2 3 4 5 6 7 8 9 10 11 12 13 | # Find the minimum IC
## Default S3 method:
FindMinIC(coly, candidates = c(""), fixed = c(""), data = list(),
modeltype = "lm", random = ~1, ic = "AIC", ...)
## S3 method for class 'formula'
FindMinIC(formula, data=list(), na.action=na.omit, fixed = c(""), random = ~1, ...)
# find the minimum IC, fmi is the shorter name form of FindMinIC
## Default S3 method:
fmi(coly, candidates = c(""), fixed = c(""), data = list(),
modeltype = "lm", random = ~1, ic = "AIC", ...)
## S3 method for class 'formula'
fmi(formula, data=list(), na.action=na.omit, fixed = c(""), random = ~1, ...)
|
formula |
A formula containing the response variable and terms. All the terms of the formula become candidates for inclusion as covariates. |
na.action |
action to use when data contains NAs. Options include na.omit, na.exclude, na.fail |
coly |
The name of the column to use for the response variable |
candidates |
A list of names of columns that are candidates for inclusion as covariates in the model |
fixed |
A list of names of columns (can be empty) that must always be included in every model |
data |
An object containing the variables for use in the model. |
modeltype |
Currently a choice between |
random |
When |
ic |
Type of information criterion to used. Defaults to |
... |
Extra arguments are passed directly into the call to |
FindMinIC tries all possible model combinations of the candidate covariates, while always including the same response variable and fixed variables. It returns a list of candidate models ranked by IC. The model combinations include all 2-way interactions among the candidate variables. Other interactions (like age^2) can be directly included in the candidates or fixed lists.
FindMinIC returns a list of candidate models sorted by information criterion IC. The first model has the "best" IC. The list is of class("cmList") while each element of that list is of class("cm")
see cmList for more details
Nicholas Lange, Tom Fletcher, Kristen Zygmunt
Burnham, K. P.; Anderson, D. R. (2004), "Multimodel inference: understanding AIC and BIC in Model Selection", Sociological Methods and Research 33: 261-304.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | data(iris)
coly="Sepal.Length"
fixed="Sepal.Width"
candidates=c("Species","-1","Sepal.Width:Species")
results.lm = FindMinIC(coly, candidates, fixed, iris)
# model with lowest IC:
first.model = getFirstModel(results.lm)
print(summary(first.model))
# model with 3rd lowest IC:
third.model = getNthModel(results.lm, 3)
print(summary(third.model))
# list of first 5 models, ordered by AIC
print(summary(results.lm)$table[1:5,])
# list of first 5 models, ordered by BIC
results.bic = FindMinIC(coly, candidates, fixed, iris, ic="BIC")
print(summary(results.bic)$table[1:5,])
fm = FindMinIC(Infant.Mortality ~ ., data = swiss)
summary(fm)
fm2 = FindMinIC(Infant.Mortality ~ Fertility + Agriculture + Education * Catholic,
data = swiss)
summary(fm2)
# list of first 5 models, ordered by AICc
if (require(nlme)) {
results.aicc = FindMinIC(distance~age, data=Orthodont,
ic="AICc", model="lme",
random= ~ 1 | Subject)
print(summary(results.aicc))
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.