rmixture
generates variates from a discrete mixture, that is
random variable with a probability density function of the form
$$f(x) = p_1 f_1(x) + ... + p_n f_n(x),$$
where \(f_1, \dots, f_n\) are densities and \(\sum_{i = 1}^n p_i
= 1\).
The values in probs
will be internally normalized to be
used as probabilities \(p_1 + \dots + p_n\).
The specification of simulation models uses the syntax of
rcomphierarc
. Models \(f_1, \dots, f_n\) are expressed in a
semi-symbolic fashion using an object of mode
expression
where each element is a complete call
to a random number generation function, with the number of variates
omitted.
The argument of the random number generation functions for the number
of variates to simulate must be named n
.
If shuffle
is FALSE
, the output vector contains all the
random variates from the first model, then all the random variates
from the second model, and so on. If the order of the variates is
irrelevant, this cuts the time to generate the variates roughly in
half.