Description Usage Arguments Details Value References See Also Examples
Sample a fixed number of balls, without replacement, from multiple urns.
1 | rmultihyper(n, k)
|
n |
a vector describing the number of balls in each urn |
k |
the total number of balls to draw from the urns |
Requesting a non-integer or negative number of balls, or more than are available in all the urns, will throw an error.
If k
is a vector of length > 1, only the first element will be used.
Specifying only one or two urns will respectively return k
or call stats::rhyper()
and issue a warning.
If k = ∑ n then the function should return n
.
A vector or array corresponding to the number of balls sampled from each of the urns, in the same format as n
.
stats::rhyper()
for sampling two different colours of balls from a single urn (equivalent to sampling one colour from two urns)
1 2 3 4 5 | rmultihyper(c(5, 10, 8), 6)
# 90% sample of citation counts data
k <- round(0.9 * sum(citations))
rmultihyper(citations, k)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.