# Use throat microbiome for illustration
data(throat.otu.tab)
comm <- t(throat.otu.tab)
comm <- comm[rowMeans(comm != 0) > 0.2, ]
# Example1: Simulate replicate sampling data, 40 subjects each with two replicates (nTime =2),
# two group comparison, 10% group differential OTUs
if (FALSE) {
sim.obj <- SimulateMSeqC(ref.otu.tab= comm,
nSubject = 40, nOTU = 50, nTime = 2,
# Within-subject correlation setting
error.sd = 1,
# Group effect setting, unbalanced
MgX = 0.5, SgX = 0, X.diff.otu.pct = 0.1, grp.ratio = 1,
balanced.X = FALSE,
# Time effect setting (No time effect)
MgT = 0, SgT = 0, SbT = 0, T.diff.otu.pct = 0,
# Interaction effect setting (No interaction effect)
MgXT = 0, SgXT = 0, XT.diff.otu.pct = 0,
# Confounder effect setting
conf.cov.cor = 0.6, confounder = 'X',
MgZ = 0.5, SgZ = 0, Z.diff.otu.pct = 0.05, Z.nondiff.otu.pct = 0.1,
# Sequencing Depth setting
depth.mu = 10000, depth.theta = 5, depth.conf.factor = 0)
}
# Example2: Simulate matched-pair data, 100 subjects each with pre- and post-treatment (nTime = 2),
# 10% differential OTUs
if (FALSE) {
sim.obj <- SimulateMSeqC(ref.otu.tab= comm,
nSubject = 100, nOTU = 50, nTime = 2,
# Within-subject correlation setting
error.sd = 1,
# Group effect setting (No group effect)
MgX = 0, SgX = 0, X.diff.otu.pct = 0, grp.ratio = 1,
# Time effect setting (No random slope, SbT=0)
MgT = 0.5, SgT = 0, SbT = 0, T.diff.otu.pct = 0.1,
# Interaction effect setting (No interaction effect)
MgXT = 0, SgXT = 0, XT.diff.otu.pct = 0,
# Confounder effect setting (T!)
conf.cov.cor = 0.6, confounder = 'T',
MgZ = 0, SgZ = 0, Z.diff.otu.pct = 0.05, Z.nondiff.otu.pct = 0.1,
# Sequencing Depth setting
depth.mu = 10000, depth.theta = 5, depth.conf.factor = 0)
}
# Example3: Simulate the general longitudinal data, 40 Subjects each with five time points,
# two groups, 10% group differential OTUs, 10 % time differential OTUs and 10 % interaction OTUs.
if (FALSE) {
sim.obj <- SimulateMSeqC(ref.otu.tab= comm,
nSubject = 40, nOTU = 50, nTime = 5,
# Within-subject correlation setting
error.sd = 1,
# Group effect setting, balanced
MgX = 0.5, SgX = 0, X.diff.otu.pct = 0.1, grp.ratio = 1,
balanced.X = TRUE,
# Time effect setting (random slope)
MgT = 0.5, SgT = 0, SbT = 0.5, T.diff.otu.pct = 0.1,
# Interaction effect setting
MgXT = 0.5, SgXT = 0, XT.diff.otu.pct = 0.1,
# Confounder effect setting
conf.cov.cor = 0.6, confounder = 'X',
MgZ = 0.5, SgZ = 0, Z.diff.otu.pct = 0.05, Z.nondiff.otu.pct = 0.1,
# Depth setting
depth.mu = 10000, depth.theta = 5, depth.conf.factor = 0)
}
Run the code above in your browser using DataLab