| Fit Multinomial {cubfits} | R Documentation |
Fit Multinomial Model (Generic)
Description
This generic function estimates b
(mutation (log(mu)) and selection (Delta.t) parameters)
depending on options set by init.function().
Usage
fitMultinom(reu13.df, phi, y, n, phi.new = NULL, coefstart = NULL)
Arguments
reu13.df |
an object of format |
phi |
an object of format |
y |
an object of format |
n |
an object of format |
phi.new |
an object of format |
coefstart |
initial value for |
Details
fitMultinom() fits a multinomial logistic regression via
vector generalized linear model fitting, vglm().
By default, for each amino acids, the last codon (order by characters)
is assumed as a based line, and other codons are compared to the based
line relatively.
In MCMC, phi.new are new proposed expression values and
used to propose new b. The coefstart is used to avoid
randomization of estimating b in vglm(),
and speed up computation.
Value
A list of format b is returned which are modified from
the returns of vglm(). Mainly, it includes
b$coefficient (parameters in vector),
b$coef.mat (parameters in matrix), and
b$R (covariance matrix of parameters, *R* matrix in QR decomposition).
Author(s)
Wei-Chen Chen wccsnow@gmail.com.
References
https://github.com/snoweye/cubfits/
Shah P. and Gilchrist M.A. “Explaining complex codon usage patterns with selection for translational efficiency, mutation bias, and genetic drift” Proc Natl Acad Sci USA (2011) 108:10231–10236.
See Also
init.function() and estimatePhi().
Examples
## 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)