
Select a formula-based model by AIC.
step4(object, …)
step4vglm(object, scope, direction = c("both", "backward", "forward"),
trace = 1, keep = NULL, steps = 1000, k = 2, …)
an object of class "vglm"
.
This is used as the initial model in the stepwise search.
See step
.
See step
.
See step
.
See step
.
any additional arguments to
extractAIC.vglm
,
drop1.vglm
and
add1.vglm
.
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.
In general,
the same warnings in
drop1.glm
and
drop1.vglm
apply here.
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.
add1.vglm
,
drop1.vglm
,
vglm
,
add1.glm
,
drop1.glm
,
backPain2
,
step
,
update
.
# NOT RUN {
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
# }
Run the code above in your browser using DataLab