% LMEx030502_4th
% Case Study 3.5.2 Page 177 in 
% Larsen & Marx (2006) Introduction to Mathematical Statistics, 4th Edition
% Written Fall by Eugene.Gallagher@umb.edu, Revised 1/12/11
% http://alpha.es.umb.edu/faculty/edg/files/edgwebp.html
% An urn contains 9 chips, N=9, five red (r=5) and 4 white. Three are drawn
% out at random (n=3) without replacement, making this a problem
% involving hypergeometric probabilities. Let X denote the number of red
% chips in the sample. Find E(X), called EX1 here.
format rat
k=0:3;r=5;N=9, n=3;
EX1 = k*hygepdf(k,N,n,r)'
% Using Theorem 3.5.2, p. 177 (after the case study)
w=N-r;
EX2=r*n/(r+w)
format