stages_bj: Backward joining of stages

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

stages_bjR Documentation

Backward joining of stages

Description

Join stages from more complex to simpler models using a distance and a threshold value.

Usage

stages_bj(
  object = NULL,
  distance = "kullback",
  thr = 0.1,
  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.

distance

character, see details.

thr

the threshold for joining stages

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 in the model stages are joined iteratively. At each iteration the two stages with minimum distance are selected and joined if their distance is less than thr.

Available distances are: manhattan (manhattan), euclidean (euclidean), Renyi divergence (reny), Kullback-Liebler (kullback), total-variation (totvar), squared Hellinger (hellinger), Bhattacharyya (bhatt), Chan-Darwiche (chandarw). See also probdist.

Value

The final staged event tree obtained.

Examples

DD <- generate_xor_dataset(n = 5, N = 1000)
model <- stages_bj(full(DD, lambda = 1), trace = 2)
summary(model)

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