Description Usage Arguments Details Value Examples
View source: R/model_selection_functions.R
Simulate data from priors for doing model selection
1 2 3 | sim.data.from.priors.for.mod.selection(n.muts, coes.prior, sigs.prior,
mods.to.sim, d.true, d.range, d.adj.max, w.wt, wts, outpath, n.samps.per.mod,
coe.sim.model = "identical", coe.dist.par = NA, print.interval = NA)
|
n.muts |
Number of mutations to simulate. Vector of the form |
coes.prior |
A vector with the lower and upper bounds on the coefficients |
sigs.prior |
Range for uniform prior on sigma |
mods.to.sim |
Models to simulate under. Vector with model names of the form c("stick", "mult", "add"). |
d.true |
True value of d. |
d.range |
Range of possible values for d. If estimate is outside this, estimate is not considered valid. |
d.adj.max |
Factor to increase observed distant to max fitness by for ad hoc d estimate (when other estimators fail) |
w.wt |
Wild type fitness. |
wts |
Weights when estimating coefficients and d. |
outpath |
Full path including file name to write results. |
n.samps.per.mod |
Number of datasets to simulate per model |
coe.sim.model |
Coefficient simulation model. See details. |
coe.dist.par |
Coefficient distribution parameter. If coe.sim.model=="uniform", then uniform is U(-coe.dist.par, +coe.dist.parm). If coe.sim.model=="normal", then distributed normal with mean given by coe.v and sigma give by coe.dist.parm. |
print.interval |
Every this many replicates, prints out replicate number. If NA (default) no printing is done. |
This function generates datasets by drawing from priors. It generates n.samps.per.mod
per model. It then analyzes each dataset under all three models writes one row of summary statistics
to the output file (defined by outpath
).
coe.sim.model
: The expected coefficient is sampled from uniform prior (coes.prior): E[coe]
The coe.sim.model determines how the individual coefficients are generated.
Possible values: "identical" means all coefficients take same value–E[coe].
"uniform" indicates to sample individual coefficients from a uniform distribution: U(E[coe]-coe.dist.par, E[coe]+coe.dist.parm).
"normal" means sample coefficients from normal distribution with mean E[coe] and sigma given by coe.dist.par.
Default = "identical".
Nothing. Instead results are written to outpath
file for later analysis
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | n.muts <- 4
n.muts <- length(Khan.data[1,])-1
geno.matrix <- Khan.data[,seq(1, n.muts)]
fit.matrix <- as.matrix(Khan.data[,(n.muts+1)])
outdir <- system.file("extdata",package="Stickbreaker")
file.name <- paste("Training_simulated_priors_fit_data_", n.muts, "muts.txt", sep="")
outpath <- paste(outdir, file.name, sep="/")
sim.data.from.priors.for.mod.selection(n.muts,
c(0.05, 0.5),
c(0, 0.25),
c(4),
1,
c(0.1, 10),
1.1,
1,
c(2,1),
outpath,
50,
coe.sim.model="identical",
coe.dist.par=NA,
print.interval=NA)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.