
Stepwise model selection in (graphical) interaction models
# S3 method for iModel
stepwise(object, criterion = "aic", alpha = NULL,
type = "decomposable", search = "all", steps = 1000, k = 2,
direction = "backward", fixin = NULL, fixout = NULL, details = 0,
trace = 2, ...)backward(object, criterion = "aic", alpha = NULL, type = "decomposable",
search = "all", steps = 1000, k = 2, fixin = NULL, details = 1,
trace = 2, ...)
forward(object, criterion = "aic", alpha = NULL, type = "decomposable",
search = "all", steps = 1000, k = 2, fixout = NULL, details = 1,
trace = 2, ...)
An iModel
model object
Either "aic"
or "test"
(for significance test)
Critical value for deeming an edge to be significant/
insignificant. When criterion="aic"
, alpha
defaults to 0;
when criterion="test"
, alpha
defaults to 0.05.
Type of models to search. Either "decomposable"
or
"unrestricted"
. If type="decomposable"
and the initial
model is decompsable, then the search is among decomposable models only.
Either 'all'
(greedy) or 'headlong'
(search edges
randomly; stop when an improvement has been found).
Maximum number of steps.
Penalty term when criterion="aic"
. Only k=2 gives genuine
AIC.
Direction for model search. Either "backward"
or
"forward"
.
Matrix (p x 2) of edges. If those edges are in the model, they are not considered for removal.
Matrix (p x 2) of edges. If those edges are not in the model, they are not considered for addition.
Controls the level of printing on the screen.
For debugging only
Further arguments to be passed on to testdelete
(for
testInEdges
) and testadd
(for testOutEdges
).
# NOT RUN {
data(reinis)
## The saturated model
m1 <- dmod(~.^., data=reinis)
m2 <- stepwise(m1)
m2
# }
Run the code above in your browser using DataLab