Description Usage Arguments Details Value Note Author(s) References See Also Examples
Initial generic functions for model fitting/approximation/prediction of cubfits.
1 2 3 4 5 6 7 8  init.function(model = .CF.CT$model[1],
type.p = .CF.CT$type.p[1],
type.Phi = .CF.CT$type.Phi[1],
model.Phi = .CF.CT$model.Phi[1],
init.Phi = .CF.CT$init.Phi[1],
init.fit = .CF.CT$init.fit[1],
parallel = .CF.CT$parallel[1],
adaptive = .CF.CT$adaptive[1])

model 
main fitted model. 
type.p 
proposal method for hyperparameters. 
type.Phi 
proposal method for Phi (true expression values). 
model.Phi 
prior of Phi. 
init.Phi 
initial methods for Phi. 
init.fit 
how is coefficient initialed in 
parallel 
parallel functions. 
adaptive 
method for adaptive MCMC. 
This function mainly takes the options, find the according generic
functions, and assign those functions to .cubfitsEnv
.
Those generic functions can be executed accordingly later within functions
for MCMC or multinomial logistic regression such as cubfits()
,
cubappr()
, and cubpred()
.
By default, those options are provided by .CF.CT
which also
leaves rooms for extensions of more complicated models and further
optimizations.
It is supposed to call this function before running any MCMC or
multinomial logistic regression. This function may affect
cubfits()
, cubpred()
, cubappr()
,
estimatePhi()
, and fitMultinom()
.
model
is the main fitting model, currently only roc
is
fully supported.
type.p
is for proposing hyperparameters in Gibb sampler. Currently,
lognormal_fix
is suggested where mean 1 is fixed for log normal
distribution. Conjugated prior and flat prior exist and are easily available
in this step
type.Phi
is for proposing Phi (expression values) in the random walk
chain updates. Only, RW_Norm
is supported. Usually, the acceptance
ratio can be adapted within 25% and 50% controlled by
.CF.AC
if adaptive = simple
.
model.Phi
is for the distribution of Phi. Typically, log normal
distribution lognormal
is assumed.
init.Phi
is a way to initial Phi. Posterior mean PM
is recommended which avoid boundary values.
init.fit
is a way of initial coefficients to fit mutation and
selection coefficients (log.mu and
Delta.t or omega)
in vglm()
. Option current
means the b
(log(mu) and Delta.t) of current MCMC iteration is the initial values, while
random
means vglm()
provides the initial values.
parallel
is a way of parallel methods to speed up code.
lapply
means lapply()
is used and no parallel;
mclapply
means mclapply()
of parallel is used and
good for shared memory machines;
task.pull
means task.pull()
of pbdMPI is used and
good for heterogeneous machines;
pbdLapply
means pbdLapply()
of pbdMPI is used and
good for homogeneous machines.
Among those, task.pull
is tested thoroughly and is the most reliable
and efficient method.
adaptive
is a way for adaptive MCMC that propose better mixing
distributions for random walks of Phi. The simple
method is
suggested and only the proposal distribution of Phi
(type.Phi = RW_Norm
) is adjusted gradually.
Return an invisible object which is a list contain all
generic functions according to the input options.
All functions are also assigned in the .cubfitsEnv
for later evaluations called by MCMC or multinomial logistic regression.
Note that all options are taken default values from the global control
object .CF.CT
, so one can utilize/alter the object's values
to adjust those affected functions.
Note that phi.Obs
should be scaled to mean 1 before
applying to MCMC.
WeiChen Chen [email protected].
https://github.com/snoweye/cubfits/
.CF.CT
, .CF.CT
, cubfits()
,
cubpred()
, and cubappr()
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19  ## Not run:
suppressMessages(library(cubfits, quietly = TRUE))
set.seed(1234)
# Convert data.
reu13.list < convert.reu13.df.to.list(ex.test$reu13.df)
y.list < convert.y.to.list(ex.test$y)
n.list < convert.n.to.list(ex.test$n)
# Get phi.pred.Init
init.function(model = "roc")
fitlist < fitMultinom(ex.train$reu13.df, ex.train$phi.Obs, ex.train$y,
ex.train$n)
phi.pred.Init < estimatePhi(fitlist, reu13.list, y.list, n.list,
E.Phi = median(ex.test$phi.Obs),
lower.optim = min(ex.test$phi.Obs) * 0.9,
upper.optim = max(ex.test$phi.Obs) * 1.1)
## End(Not run)

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.