Here's an interesting feature of the hypergeometric probability distribution discovered by one of my students in a Matlab homework. It is probably well known, but I didn't know it until today. I proved the result with the symbolic math toolbox.
Does the probability of drawing exactly X of a possible K items in N drawings without replacement from a group of M objects equal the probability of drawing exactly X of a possible N items in K drawings without replacement from a group of M objects?
A proof using Matlabâ€™s symbolic math toolbox:
% Written by Eugene.Gallagher@umb.edu
syms N X K M y z
% Equation for expanded hypergeometric pdf from p 111 of
% Larsen and Marx 2012 Introduction to Mathematical Statistics, 5th edition
y=factorial(N)/(factorial(X)*factorial(NX))*factorial(K)/factorial(KX)*factorial(MK)/factorial((MK)N+X)/(factorial(M)/factorial(MN))
% swap N and K, save as z
z=factorial(K)/(factorial(X)*factorial(KX))*factorial(N)/factorial(NX)*factorial(MN)/factorial((MN)K+X)/(factorial(M)/factorial(MK))
fprintf('y/z:\n')
y/z
fprintf('Switching N and K will always produce identical hypergeometric probabilities.\nQ.E.D.\n')
fprintf('An example based on problem 3.2.26 on p 117 in Larsen & Marx (2012):\n')
X=6;M=80;K=20;N=10;
hygepdf(X,M,K,N)
hygepdf(X,M,N,K)
eval(y)
X=6;M=80;K=10;N=20;
eval(y)
