% LMcs040201_4th.m
% Case Study 4.2.1 Leukemia cancer cluster. Pp 278-279 in
% Larsen & Marx (2006) Introduction to Mathematical Statistics 4th Edition
% Written by Eugene D. Gallagher for UMASS/Boston's EEOS601
% Eugene.Gallagher@umb.edu, http://www.es.umb.edu/edgwebp.htm
% Written 10/1/2010; Revised 1/7/11
% p=incidence of leukemia in 5 1/3 years in towns around Niles IL
% What is the probability of observing 8 or more childhood leukemia cases
% by chance alone. Solve using the binomial pdf and the Poisson limit.
% N=number of people in Niles IL
N=7076;
p=24.8/1e5;
X=8:7076;X=X';
bp=binopdf(X,N,p);
BP=sum(bp); % or it could be solved using the complement
X2=0:7;
BP2=1-sum(binopdf(X2,N,p));
fprintf(...
'\nFrom the binomial pdf, the exact probability of observing \n8 or more ') 
fprintf('deaths among 7076 children in 5 1/3 years is %6.3g.\n',BP);
fprintf(...
'From the complement of the binomial pdf, the exact p of observing \n8 or')
fprintf(' more deaths among 7076 children in 5 1/3 years is %6.3g.\n',BP2);
% Now solve using the Poisson pdf;
% lambda is the expected number of cases among 7076 in Niles Illionois
lambda=7076*24.8e-5;
PP= 1-sum(poisspdf(X2,lambda));
fprintf(...
'\nFrom the Poisson pdf, the approximate probability of observing \n8 or ') 
fprintf('more deaths among 7076 children in 5 1/3 years with a Poisson \n')
fprintf('expected value of %6.3g is %6.3g.\n\n',lambda,PP);

% Or, one could use the Poisson cumulative distribution function:
PCP = 1-poisscdf(7,lambda);
fprintf(...
'From the cumulative Poisson pdf, the approximate probability of \n') 
fprintf('observing 8 or more deaths among 7076 children in 5 1/3 years ')
fprintf('with \na Poisson expected value of %6.3g is %6.3g.\n\n',...
    lambda,PCP);
RE=abs(BP-PP)/BP * 100;
fprintf(...
'The relative error in the Poisson approximation is %4.1f%%\n',RE)
