MIDASim.modify {MIDASim} | R Documentation |
Modifying MIDASim model
Description
MIDASim.modify() modifies the fitted MIDASim.setup model according to user specification that one or multiple of the following characteristics, such as the library sizes, taxa relative abundances, location parameters of the parametric model can be changed. This is useful if the users wants to introduce an 'effect' in simulation studies.
Usage
MIDASim.modify(
fitted,
lib.size = NULL,
mean.rel.abund = NULL,
gengamma.mu = NULL,
sample.1.prop = NULL,
taxa.1.prop = NULL,
individual.rel.abund = NULL,
...
)
Arguments
fitted |
Output from MIDASim.setup. |
lib.size |
Numeric vector of pre-specified library sizes (length should
be equal to |
mean.rel.abund |
Numeric vector of specified mean relative abundances for
taxa. Length should be equal to |
gengamma.mu |
Numeric vector of specified location parameters for the
parametric model (generalized gamma model). Specify either |
sample.1.prop |
Numeric vector of specified proportion of non-zeros for
subjects (the length should be equal to |
taxa.1.prop |
Numeric vector of specified proportion of non-zeros for
taxa (the length should be equal to |
individual.rel.abund |
Numeric matrix of expected relative abundances
with |
... |
Additional arguments. If SCAM model is chosen for parameter changes
under the non-parametric mode, specify |
Details
The parametric model in MIDASim is a location-scale model, specifically, a
generalized gamma model for relative abundances \pi
of a taxon. Denote t = 1/\pi
.
The generalized gamma distribution for t
is chosen so that
ln(t)\ =\ \mu\ +\ \sigma \cdot w
where w
follows a log gamma distribution with a shape parameter 1/Q
.
MIDASim fits the model to the template data and estimates parameters \mu
, \sigma
and Q
by matching the first two moments of \pi
and maximizing the likelihood.
Value
Returns an updated list with different elements depending on the value
of fitted$mode
:
n.sample |
Target sample size in the simulation. |
lib.size |
Target library sizes in the simulation. |
taxa.1.prop |
Updated proportions of non-zero values for each taxon. |
sample.1.prop |
Updated proportion of non-zero cells for each subject. |
theta |
Mean values of the multivariate normal distribution in generating presence-absence data. |
eta |
Adjustment to be applied to samples in generating presence- absence data. |
Author(s)
Mengyu He
Examples
data("throat.otu.tab")
otu.tab = throat.otu.tab[,colSums(throat.otu.tab>0)>1]
fitted = MIDASim.setup(otu.tab, mode = 'parametric')
# modify library sizes
fitted.modified <- MIDASim.modify(fitted,
lib.size = sample(fitted$lib.size, 2*nrow(otu.tab),
replace = TRUE) )
# modify mean relative abundances
fitted.modified <- MIDASim.modify(fitted,
mean.rel.abund = fitted$mean.rel.abund * runif(fitted$n.taxa))