| dhyper_rvec {rvec} | R Documentation |
The Hypergeometric Distribution, Using Multiple Draws
Description
Density, distribution function, quantile function and random generation for the hypergeometric distribution, modified to work with rvecs.
Usage
dhyper_rvec(x, m, n, k, log = FALSE)
phyper_rvec(q, m, n, k, lower.tail = TRUE, log.p = FALSE)
qhyper_rvec(p, m, n, k, lower.tail = TRUE, log.p = FALSE)
rhyper_rvec(nn, m, n, k, n_draw = NULL)
Arguments
x |
Quantiles. Can be an rvec. |
m |
Number of white balls in the urn.
See |
n |
Number of black balls
in the urn. See |
k |
Number of balls drawn from urn.
See |
log, log.p |
Whether to return results
on a log scale. Default is
|
q |
Quantiles. Can be an rvec. |
lower.tail |
Whether to return
|
p |
Probabilities. Can be an rvec. |
nn |
The length of the random vector
being created. The equivalent of |
n_draw |
Number of random draws in the random vector being created. Cannot be an rvec. |
Details
Functions dhyper_rvec(), phyper_rvec(),
phyper_rvec() and rhyper_rvec() work like
base R functions dhyper(), phyper(),
qhyper(), and rhyper(), except that
they accept rvecs as inputs. If any
input is an rvec, then the output will be too.
Function rhyper_rvec() also returns an
rvec if a value for n_draw is supplied.
dhyper_rvec(), phyper_rvec(),
phyper_rvec() and rhyper_rvec()
use tidyverse
vector recycling rules:
Vectors of length 1 are recycled
All other vectors must have the same size
Value
If any of the arguments are rvecs, or if a value for
n_drawis supplied, then an rvecOtherwise an ordinary R vector.
See Also
Examples
x <- rvec(list(c(3, 5),
c(0, 2)))
dhyper_rvec(x, m = 6, n = 6, k = 5)
phyper_rvec(x, m = 6, n = 6, k = 5)
rhyper_rvec(nn = 2,
k = c(3, 5),
m = 6,
n = 6,
n_draw = 1000)