View source: R/distributions.R
| dhyper_rvec | R Documentation |
Density, distribution function, quantile function and random generation for the hypergeometric distribution, modified to work with rvecs.
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)
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. |
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
If any of the arguments are rvecs,
or if a value for n_draw is supplied,
then an rvec; otherwise an ordinary R vector.
Unlike base rhyper(), rhyper_rvec()
always returns doubles.
dhyper(), phyper(), qhyper(), rhyper() Base R equivalents
distributions All base R distributions
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.