stages_hc: Hill-climbing

View source: R/4-model-selection.R

stages_hcR Documentation

Hill-climbing

Description

Greedy search of staged event trees with iterative moving of nodes between stages.

Usage

stages_hc(
  object,
  score = function(x) {     return(-BIC(x)) },
  max_iter = Inf,
  scope = NULL,
  ignore = object$name_unobserved,
  trace = 0
)

Arguments

object

an object of class sevt with fitted probabilities and data, as returned by full or sevt_fit.

score

the score function to be maximized.

max_iter

the maximum number of iterations per variable.

scope

names of variables that should be considered for the optimization

ignore

vector of stages which will be ignored and left untouched, by default the name of the unobserved stages stored in object$name_unobserved.

trace

if >0 increasingly amount of info is printed (via message).

Details

For each variable node-moves that best increases the score are performed until no increase is possible. A node-move is either changing the stage associate to a node or move the node to a new stage.

The ignore argument can be used to specify stages that should not be affected during the search, that is left untouched. This is useful for preserving structural zeroes and to speed-up computations.

Value

The final staged event tree obtained.

Examples

start <- indep(PhDArticles[,1:5], join_unobserved = TRUE)
model <- stages_hc(start)

stagedtrees documentation built on April 29, 2022, 1:06 a.m.