Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

step4vglm

Choose a model by AIC in a Stepwise Algorithm


Description

Select a formula-based model by AIC.

Usage

step4(object, ...)
step4vglm(object, scope, direction = c("both", "backward", "forward"),
          trace = 1, keep = NULL, steps = 1000, k = 2, ...)

Arguments

object

an object of class "vglm". This is used as the initial model in the stepwise search.

scope

See step.

direction

See step.

trace, keep

See step.

steps, k

See step.

...

any additional arguments to extractAIC.vglm, drop1.vglm and add1.vglm.

Details

This function is a direct adaptation of step for vglm-class objects. Since step is not generic, the name step4() was adopted and it is generic, as well as being S4 rather than S3. It is the intent that this function should work as similar as possible to step.

Internally, the methods function for vglm-class objects calls add1.vglm and drop1.vglm repeatedly.

Value

The results are placed in the post slot of the stepwise-selected model that is returned. There are up to two additional components. There is an "anova" component corresponding to the steps taken in the search, as well as a "keep" component if the keep= argument was supplied in the call.

Warning

In general, the same warnings in drop1.glm and drop1.vglm apply here.

This function

See Also

Examples

data("backPain2", package = "VGAM")
summary(backPain2)
fit1 <- vglm(pain ~ x2 + x3 + x4 + x2:x3 + x2:x4 + x3:x4,
             propodds, data = backPain2)
spom1 <- step4(fit1)
summary(spom1)
spom1@post$anova

VGAM

Vector Generalized Linear and Additive Models

v1.1-5
GPL-3
Authors
Thomas Yee [aut, cre], Cleve Moler [ctb] (author of several LINPACK routines)
Initial release
2021-01-13

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.