You have a box of N balls. M of them are red (R), and the rest (N−M) are blue (B). If you pick n balls from the box without replacing any, let X be the number of red balls picked.
In this case, we say X follows a hypergeometric distribution – X follows hypergeometric(n,M,N).
Note that the probability of choosing a red ball changes as different types of balls are removed from the box. This is the property that distinguishes this type of distribution.
Ex. Suppose N=20, M=12 (so N−M=8), and n=5. Find the probability mass function of X.
Possible values of X: 0,1,2,...5.
p(0)=P(X=0)p(1)=P(X=1)p(2)=P(X=2)p(3)=P(X=3)...=(520)(58)=(520)(112)⋅(48)=(520)(212)⋅(38)=(520)(312)⋅(28)
In the general case, values of X have to satisfy these constraints for p(k) to be nonzero:
a) 0≤k≤n
b) k≤M
c) 0≤n−k≤N−M
These can be combined into one constraint: Max{0, n−N+M}≤k≤Min{n, M}.
For any k satisfying this constraint, p(k)=P(X=k)=(nN)(kM)(n−kN−M)
Here, p is the probability mass function for the hypergeometric distribution. It is usually represented by the notation h(k;n,M,n).
Expected Value and Variance
Let X follow hypergeometric(n,N,M). Then E(X)=n⋅NM and V(X)=(N−1N−n)⋅n⋅NM⋅(1−NM).
Note that if we let p=NM, then E(X)=np and V(X)=np(1−p)⋅(N−1N−n).
E(X) here is exactly the same as that of the binomial distribution, and V(X) is the same as well except for the introduction of the rightmost term.
If N is much larger than n (N>>n), then that rightmost term will be very close to 1. This reflects the fact that when N>>n you can approximate the pmf of a hypergeometric distribution by using a binomial distribution table, since the chance of success will be barely affected by previous trials in this case.
We repeat an experiment until we have r successes. For each experiment, we have the same probability of success p=P({S}). Let X be the number of failures before the rth success. We say X follows a negative binomial distribution – X follows NB(r,p).
Ex. Suppose r=3 and p=31.
Possible values of X: 0,1,2,..., any natural number
If X=5, then we know eight trials were performed, and that the last one has to have been a success. Thus, P(X=5) should be the probability of three successes and five failures occurring, multiplied by the number of ways that two successes can occur within the first seven trials.P(X=5)=(27)(31)3(1−31)5.
In general if X foloows NB(r,p), then p(k)=P(X=k)=(r−1k+r−1)⋅pr(1−p)k.
Expected Value and Variance
Let X follow NB(r,p). Then E(X)=pr(1−p) and V(X)=p2r(1−p).