stepwise: Stepwise model selection in (graphical) interaction models

stepwiseR Documentation

Stepwise model selection in (graphical) interaction models

Description

Stepwise model selection in (graphical) interaction models

Usage

drop_func(criterion)

## S3 method for class '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,
  ...
)

Arguments

criterion

Either "aic" or "test" (for significance test)

object

An iModel model object

alpha

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

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.

search

Either 'all' (greedy) or 'headlong' (search edges randomly; stop when an improvement has been found).

steps

Maximum number of steps.

k

Penalty term when criterion="aic". Only k=2 gives genuine AIC.

direction

Direction for model search. Either "backward" or "forward".

fixin

Matrix (p x 2) of edges. If those edges are in the model, they are not considered for removal.

fixout

Matrix (p x 2) of edges. If those edges are not in the model, they are not considered for addition.

details

Controls the level of printing on the screen.

trace

For debugging only

...

Further arguments to be passed on to testdelete (for testInEdges) and testadd (for testOutEdges).

Author(s)

Søren Højsgaard, sorenh@math.aau.dk

See Also

cmod, dmod, mmod, testInEdges, testOutEdges

Examples


data(reinis)
## The saturated model
m1 <- dmod(~.^., data=reinis)
m2 <- stepwise(m1)
m2

gRim documentation built on Sept. 11, 2024, 7:02 p.m.