define_model: Define decision tree model

View source: R/define_model.R

define_modelR Documentation

Define decision tree model

Description

Basic constructor for decision tree classes for different data formats.

Usage

define_model(transmat, tree_dat, dat_long, ...)

Arguments

transmat

Transition probability matrix. Rows are from nodes and columns are to nodes.

tree_dat

Hierarchical tree structure of parents and children in a list of vectors with integer values.

dat_long

Long format data frame with from, to, prob, vals columns.

...

additional arguments

Value

transmat, tree_dat or dat_long class object

Examples


define_model(transmat =
              list(prob = matrix(data=c(NA, 0.5, 0.5), nrow = 1),
                   vals = matrix(data=c(NA, 1, 2), nrow = 1)
              ))

define_model(tree_dat =
              list(child = list("1" = c(2, 3),
                                "2" = NULL,
                                "3" = NULL),
                   dat = data.frame(node = 1:3,
                                    prob = c(NA, 0.5, 0.5),
                                    vals = c(0, 1, 2))
              ))

define_model(dat_long = data.frame(from = c(NA, 1, 1),
                                   to = 1:3,
                                   prob = c(NA, 0.5, 0.5),
                                   vals = c(0, 1, 2)))

n8thangreen/CEdecisiontree documentation built on Sept. 13, 2022, 5:25 a.m.