sevt {stagedtrees}R Documentation

Staged event tree (sevt) class

Description

Structure and usage of S3 class sevt, used to store a staged event tree.

Usage

sevt(x, full = FALSE, order = NULL)

## S3 method for class 'table'
sevt(x, full = FALSE, order = names(dimnames(x)))

## S3 method for class 'data.frame'
sevt(x, full = FALSE, order = colnames(x))

## S3 method for class 'list'
sevt(x, full = FALSE, order = names(x))

Arguments

x

a list, a data frame or table object.

full

logical, if TRUE the full model is created otherwise the independence model.

order

character vector, order of the variables to build the tree, by default the order of the variables in x.

Details

A staged event tree object is a list with components:

The tree structure is never defined explicitly, instead it is implicitly defined by the list tree containing the order of the variables and the names of their levels. This is sufficient to define a complete symmetric tree where an internal node at a depth related to a variable v has a number of children equal to the cardinality of the levels of v. The stages information is instead stored as a list of vectors, where each vector is indexed as the internal nodes of the tree at a given depth.

To define a staged tree from data (data frame or table) the user can call either full or indep which both construct the staged tree object, attach the data in ctables and compute probabilities. After, one of the available model selection algorithm can be used, see for example stages_hc, stages_bhc or stages_hclust. If, mainly for development, only the staged tree structure is needed (without data or probabilities) the basic sevt constructor can be used.

Value

A staged event tree object, an object of class sevt.

Examples


######### from table
model.titanic <- sevt(Titanic, full = TRUE)

######### from data frame
DD <- generate_random_dataset(p = 4, n = 1000)
model.indep <- sevt(DD)
model.full <- sevt(DD, full = TRUE)

######### from list
model <- sevt(list(
  X = c("good", "bad"),
  Y = c("high", "low")
))

[Package stagedtrees version 2.3.0 Index]