RtreemixStats-class {Rtreemix} | R Documentation

## Class "RtreemixStats"

### Description

The `RtreemixStats` class contains the (weighted, log) likelihoods for a given dataset (specified by the parent class) derived from the probability distribution induced by an underlying mutagenetic trees mixture model.

### Objects from the Class

Objects can be created by calls of the form `new("RtreemixStats", Data, Model, LogLikelihoods, WLikelihoods)`. The class `RtreemixStats` extends the `RtreemixData` class and specifies (log, weighted) likelihoods for these data derived from a given `RtreemixModel`. The number of the genetic events in the patterns from the given dataset (`Data`) has to be equal to the number of genetic events in the branchings from the mixture model given by the slot `Model`. When having the weighted likelihoods, one can easily derive the responsibilities of the model components in `Model` for generating the patterns in the specified dataset (`Data`).

The `Data` is an `RtreemixData` object that specifies the patterns for which the likelihoods are calculated.

The `Model` is an `RtreemixModel` object that specifies the mutagenetic trees mixture model used for deriving the likelihoods of the given data.

The `LogLikelihoods` is a numeric `vector` that contains the log-likelihoods of the patterns in `Data`. Its length equals the sample size, i.e. the number of patients in `Data`.

The `WLikelihoods` is a numeric `matrix` that specifies the weighted likelihoods of each pattern in the given dataset `Data`. The number of columns in `WLikelihoods` equals the number of tree components in `Model` and the number of rows equals the number of patients in `Data`.

### Slots

`Model`:
  Object of class `"RtreemixModel"`.
`LogLikelihoods`:
  Object of class `"numeric"`. The length of `LogLikelihoods` must be equal to the number of patients of the dataset specified with the parent `"RtreemixData"` class.
`WLikelihoods`:
  Object of class `"matrix"`. The number of rows must be equal to the sample size of the dataset specified with the parent `"RtreemixData"` class. The number of columns must be identical with the number of tree components in the mixture model `Model`.

### Extends

Class `"RtreemixData"`, directly.

### Methods

LogLikelihoods
  `signature(object = "RtreemixStats")`: A method for obtaining the log-likelihoods of the patterns in the dataset specified with the parent `"RtreemixData"` class.
Model
  `signature(object = "RtreemixStats")`: A method for obtaining the mutagenetic trees mixture model used for deriving the likelihoods.
WLikelihoods
  `signature(object = "RtreemixStats")`: A method for obtaining the weighted likelihoods of the patterns in the dataset specified with the parent `"RtreemixData"` class.
getData
  `signature(object = "RtreemixStats")`: A method for obtaining the dataset specified with the parent `"RtreemixData"` class.
getResp
  `signature(object = "RtreemixStats")`: A method for computing the matrix of responsibilities for the trees to generate each of the samples in the parent dataset from their weighted likelihoods `WLikelihoods`.

### Author(s)

Jasmina Bogojeska

### References

Learning multiple evolutionary pathways from cross-sectional data, N. Beerenwinkel et al.

### See Also

`RtreemixData-class`, `RtreemixModel-class`, `fit-methods`, `likelihoods-methods`

### Examples

    ## Generate a random RtreemixModel object with 3 components and 9 genetic events.
    mod <- generate(K = 3, no.events = 9, noise.tree = TRUE, prob = c(0.2, 0.8))
    show(mod)

    ## Draw a data sample from the model mod.
    data <- sim(model = mod, no.draws = 400)

    ## Create an RtreemixStats object.
    mod.stat <- likelihoods(model = mod, data = data)
    show(mod.stat)

    ## See the slots from the RtreemixStats object.
    Model(mod.stat)
    LogLikelihoods(mod.stat)
    WLikelihoods(mod.stat)
    ## See data.
    getData(mod.stat)
    ## Calculate the responsibilities from the weighted likelihoods.
    getResp(mod.stat)

[Package Rtreemix version 1.6.0 Index]