Learn R Programming

Oncotree (version 0.3.2)

distribution.oncotree: Find the event distribution defined by an oncogenetic tree

Description

distribution.oncotree calculates the joint distribution of the events defined by the tree, while marginal.distr calculates the marginal probability of occurrence of each event.

Usage

distribution.oncotree(otree, with.probs = TRUE, with.errors=FALSE,
          edge.weights=if (with.errors) "estimated" else "observed")
   marginal.distr(otree, with.errors = TRUE,
          edge.weights=if (with.errors) "estimated" else "observed")

Arguments

otree
An object of class oncotree.
with.probs
A logical value specifying if only the set of possible outcomes should be returned (if TRUE), or the associated probabilities of occurrence as well.
with.errors
A logical value specifying whether false positive and negative error rates should be incorporated into the distribution.
edge.weights
A choice of whether the observed or estimated edge transition probabilities should be used in the calculation of probabilities. See oncotree.fit for explanation of the difference. By default,

Value

  • For distribution.oncotree: a data frame each row of which gives a possible outcome. For marginal.distr: a named numeric vector - the names are the event names (+ Root) and the values are the corresponding marginal probability of occurrence.

See Also

oncotree.fit

Examples

Run this code
data(ov.cgh)
   ov.tree <- oncotree.fit(ov.cgh)
   
   #joint distribution
   jj <- distribution.oncotree(ov.tree, edge.weights="obs")
   head(jj)
   jj.eps <- distribution.oncotree(ov.tree, with.errors=TRUE)
   head(jj.eps)
  
   #marginal distribution
   marginal.distr(ov.tree, with.error=FALSE)
   #marginal distribution calculated from the joint
   apply(jj[1:ov.tree$nmut], 2, function(x){sum(x*jj$Prob)})
   
   ##Same with errors incorporated
   #marginal distribution
   marginal.distr(ov.tree, with.error=TRUE)
   #marginal distribution calculated from the joint
   apply(jj.eps[1:ov.tree$nmut], 2, function(x){sum(x*jj.eps$Prob)})

Run the code above in your browser using DataLab