Erl | R Documentation |
Hypergeometric distribution where we have a sample of k balls from an urn containing N, of which m are white and n are black.
expValErl(N = n + m, m, n = N - m, k)
varErl(N = n + m, m, n = N - m, k)
N |
Total number of balls (white and black) in the urn. |
m |
Number of white balls in the urn. |
n |
Number of black balls in the urn. Can specify n instead of N. |
k |
Number of balls drawn from the urn, k = 0, 1, ..., m + n. |
The Hypergeometric distribution for N
total items of which
m
are of one type and n
of the other and from which
k
items are picked has probability mass function :
Pr(X = x) = \frac{\left(\frac{m}{k}\right)\left(\frac{n}{k - x}\right)}{\left(\frac{N}{k}\right)}
for x = 0, 1, \dots, \min(k, m)
.
Function :
expValErl
gives the expected value.
varErl
gives the variance.
Invalid parameter values will return an error detailing which parameter is problematic.
# With total balls specified
expValErl(N = 5, m = 2, k = 2)
# With number of each colour of balls specified
expValErl(m = 2, n = 3, k = 2)
# With total balls specified
varErl(N = 5, m = 2, k = 2)
# With number of each colour of balls specified
varErl(m = 2, n = 3, k = 2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.