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 |
scope |
See |
direction |
See |
trace , keep |
See |
steps , k |
See |
... |
any additional arguments to
|
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
add1.vglm
,
drop1.vglm
,
vglm
,
trim.constraints
,
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