vlmctree {VLMC}R Documentation

Compute the tree structure of a "vlmc" object

Description

Compute the tree representation of a "vlmc" object as R list.

Usage

vlmctree(x)

## S3 method for class 'vtree'
str(object, ...)
.vvec2tree(vv, k, chk.lev)

Arguments

x, object

typically the result of vlmc(..).

vv

integer vector encoding the fitted vlmc, typically x$vlmc.vec[-1].

k

integer, the alphabet size.

chk.lev

integer internally used for consistency checking.

...

further arguments passed to or from methods.

Details

.vvec2tree is the internal (recursive) function building up the tree.

str.vtree is a method for the generic str function and typically for the output of vlmctree(). For each node, it gives the “parenting level” in braces and the counts.

Value

A list of class "vtree" representing the tree structure recursively.

Each “node” of the tree is itself a list with components

level

length-2 integer giving the level in {0,1,...}, counted from the root (which is 0) and the parenting level, i.e the longest branch.

count

integer vector of length k where k is the number of “letters” in the alphabet.

total

equals to sum(* $ count).

child

a list (of length k) of child nodes or NULL (i.e. not there).

Author(s)

Martin Maechler

See Also

vlmc.

Examples

data(presidents)
dpres <- cut(presidents, c(0,45,70, 100)) # three values + NA
table(dpres <- factor(dpres, exclude = NULL)) # NA as 4th level

(vlmc.prc1 <- vlmc(dpres, cut = 1, debug = TRUE))
str(vv.prc1 <- vlmctree(vlmc.prc1))

[Package VLMC version 1.4-3-1 Index]