draw_multinom {MicroMoB} | R Documentation |
Draw a multinomially distributed random vector
Description
Warning: this function does no argument checking. Ensure the arguments are as follows.
Usage
draw_multinom(n, prob)
Arguments
n |
an integer giving the number of balls to distribute in bins |
prob |
a vector of probabilities for each bin, which must sum to one |
Value
an integer vector of length equal to the length of prob
Note
This function uses the algorithm presented in: Startek, MichaĆ. "An asymptotically optimal, online algorithm for weighted random sampling with replacement." arXiv preprint arXiv:1611.00532 (2016).
[Package MicroMoB version 0.1.2 Index]