R: Choose a model by AIC in a Stepwise Algorithm

step4 {VGAM} | R Documentation

## 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.

### See Also

`add1.vglm`, `drop1.vglm`, `vglm`, `add1.glm`, `drop1.glm`, `backPain2`, `step`, `update`.

### 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

[Package VGAM version 1.1-3 Index]