Learn R Programming

MASSExtra (version 1.2.2)

step_AIC: Stepwise model construction and inspection

Description

Front-ends to stepAIC and dropterm with changed defaults. step_BIC implements a stepwise selection with BIC as the criterion and step_GIC uses an experimental criterion with a penalty midway between AIC and BIC: the "Goldilocks" criterion.

Usage

step_AIC(object, ..., trace = 0, k = 2)

step_BIC(object, ..., trace = 0, k = max(2, log(nobs(object))))

step_GIC(object, ..., trace = 0, k = (2 + log(nobs(object)))/2)

drop_term( object, ..., test = default_test(object), k, sorted = TRUE, decreasing = TRUE, delta = TRUE )

add_term( object, ..., test = default_test(object), k, sorted = TRUE, decreasing = TRUE, delta = TRUE )

Value

A fitted model object after stepwise refinement, or a data frame with extra class membership for single term functions.

Arguments

object

as for stepAIC

...

additional arguments passed on to main function in MASS

trace, k

as for stepAIC

sorted, test

as for dropterm and addterm

decreasing

in drop_term should the rows be displayed in decreasing order, that is best to worst terms, from that of dropterm?

delta

Should the criterion be displayed (FALSE) or the change in the in the criterion relative to the present model (TRUE)?

Examples

Run this code
fm <- glm.nb(Days ~ .^3, quine)
drop_term(fm_aic <- step_AIC(fm))
drop_term(fm_bic <- step_BIC(fm))

Run the code above in your browser using DataLab