get.tree.levels {Rtreemix} | R Documentation

## Function for constructing level vectors

### Description

Function that assignes to each node the level at which that node is in a specific tree (`tree.num`) of the mutagenetic trees mixture model `mixture`. The `start.val` is the number assigned to the events pruned from the tree. This usually is the maximum depth of the tree with which the tree specified with `tree.num` will be compared.

### Usage

    get.tree.levels(mixture, tree.num, start.val)

### Arguments

`mixture` | An object of the class `RtreemixModel`.
`tree.num` | A `numeric` specifying the tree component from `mixture` used for creating the level vector.
`start.val` | A `numeric` specifying the number assigned to the pruned events.

### Value

The function returns a named `numeric` vector. Its length equals the number of genetic events in `mixture` minus one (for the initial null event which is always on level 0). The vector names correspond to the names of the genetic events and each vector component gives the level at which the respective event is in the `num.tree` tree of `mixture`.

### Author(s)

Jasmina Bogojeska

### See Also

`comp.models`, `comp.trees`, `stability.sim`, `RtreemixModel-class`, `fit-methods`

### Examples

    ## Generate two random RtreemixModel objects each with 3 components.
    rand.mod <- generate(K = 3, no.events = 9, noise.tree = TRUE, prob =
    c(0.2, 0.8))

    ## Get the tree levels of the 2nd component of the model rand.mod.
    get.tree.levels(mixture = rand.mod, tree.num = 2, start.val = 10)

[Package Rtreemix version 1.56.0 Index]