NegHyper | R Documentation |
Probability mass function, distribution function, quantile function and random generation for the negative hypergeometric distribution.
dnhyper(x, n, m, r, log = FALSE)
pnhyper(q, n, m, r, lower.tail = TRUE, log.p = FALSE)
qnhyper(p, n, m, r, lower.tail = TRUE, log.p = FALSE)
rnhyper(nn, n, m, r)
x , q |
vector of quantiles representing the number of balls drawn without replacement from an urn which contains both black and white balls. |
n |
the number of black balls in the urn. |
m |
the number of white balls in the urn. |
r |
the number of white balls that needs to be drawn for the sampling to be stopped. |
log , log.p |
logical; if TRUE, probabilities p are given as log(p). |
lower.tail |
logical; if TRUE (default), probabilities are |
p |
vector of probabilities. |
nn |
number of observations. If |
Negative hypergeometric distribution describes number of balls x
observed
until drawing without replacement to obtain r
white balls
from the urn containing m
white balls and n
black balls,
and is defined as
f(x) = \frac{{x-1 \choose r-1}{m+n-x \choose m-r}}{{m+n \choose n}}
The algorithm used for calculating probability mass function, cumulative distribution function and quantile function is based on Fortran program NHYPERG created by Berry and Mielke (1996, 1998). Random generation is done by inverse transform sampling.
Berry, K. J., & Mielke, P. W. (1998). The negative hypergeometric probability distribution: Sampling without replacement from a finite population. Perceptual and motor skills, 86(1), 207-210. https://journals.sagepub.com/doi/10.2466/pms.1998.86.1.207
Berry, K. J., & Mielke, P. W. (1996). Exact confidence limits for population proportions based on the negative hypergeometric probability distribution. Perceptual and motor skills, 83(3 suppl), 1216-1218. https://journals.sagepub.com/doi/10.2466/pms.1996.83.3f.1216
Schuster, E. F., & Sype, W. R. (1987). On the negative hypergeometric distribution. International Journal of Mathematical Education in Science and Technology, 18(3), 453-459.
Chae, K. C. (1993). Presenting the negative hypergeometric distribution to the introductory statistics courses. International Journal of Mathematical Education in Science and Technology, 24(4), 523-526.
Jones, S.N. (2013). A Gaming Application of the Negative Hypergeometric Distribution. UNLV Theses, Dissertations, Professional Papers, and Capstones. Paper 1846. https://digitalscholarship.unlv.edu/cgi/viewcontent.cgi?referer=&httpsredir=1&article=2847&context=thesesdissertations
Hypergeometric
x <- rnhyper(1e5, 60, 35, 15)
xx <- 15:95
plot(prop.table(table(x)))
lines(xx, dnhyper(xx, 60, 35, 15), col = "red")
hist(pnhyper(x, 60, 35, 15))
xx <- seq(0, 100, by = 0.01)
plot(ecdf(x))
lines(xx, pnhyper(xx, 60, 35, 15), col = "red", lwd = 2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.