To determine whether the sampled tree will be accepted

Description

To determine whether the sampled tree will be accepted by comparing the likelihood, used in canopy.sample.

Usage

1
addsamptree(tree,tree.new,diagnostics)

Arguments

tree

input tree (current)

tree.new

input tree (newly sampled)

diagnostics

whether diagnostics should be output

Value

returned tree (either retain the old tree or accept the new tree).

Author(s)

Yuchao Jiang yuchaoj@wharton.upenn.edu

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
data(MDA231)
data(MDA231_tree)
sna.name = MDA231$sna.name
Y = MDA231$Y
C = MDA231$C
R = MDA231$R
X = MDA231$X
WM = MDA231$WM
Wm = MDA231$Wm
epsilonM = MDA231$epsilonM
epsilonm = MDA231$epsilonm
# sampling location of SNAs
tree.new = MDA231_tree
tree.new$sna = sampsna(MDA231_tree)
tree.new$Z = getZ(tree.new, sna.name)
tree.new$Q = getQ(tree.new, Y, C)
tree.new$H = tree.new$Q
tree.new$VAF = getVAF(tree.new, Y)
tree.new$likelihood = getlikelihood(tree.new, R, X, WM, Wm, epsilonM, epsilonm)
tree = addsamptree(MDA231_tree,tree.new, diagnostics = TRUE)