simulation_dtm: simulate data from DTM

Description Usage Arguments Value Examples

View source: R/simulate_dtm.R

Description

simulate data from DTM

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
simulation_dtm(
  p,
  seed = 1,
  N,
  tree,
  control_pi,
  case_pi,
  control_theta,
  case_theta
)

Arguments

p

the number of taxa

seed

a random seed

N

sample size of each group

tree

a phylogenetic tree

control_pi

a probability vector for each taxon which were sum to 1 in control group

case_pi

a probability vector for each taxon which were sum to 1 in case group

control_theta

the over-dispersion parameter

case_theta

the over-dispersion parameter

Value

dtm_table the otu table

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
p <- 40
set.seed(1)
tree <- simulate_tree(p)
control_pi = case_pi = c()
for(j in (p+1):(p+tree$Nnode)){
set.seed(j)
random_pi <- runif(1,0.2,0.4)
control_pi[which(tree$edge[,1]==j)] <- c(random_pi, 1-random_pi)
case_pi[which(tree$edge[,1]==j)] <- c(random_pi, 1-random_pi)}
control_theta = case_theta = rep(0.1, tree$Nnode)
group <- rep(c(0,1),each =20)
tree_table <- simulation_dtm(p=40,tree, seed=1, N=20,control_pi,
case_pi,control_theta,case_theta)

liudoubletian/eBay documentation built on Oct. 10, 2020, 8:43 p.m.