% LMex040202_4th.m
% Example 4.2.2 Shady Rest Hospital cardiac monitoring machines, p. 277-288
% Larsen & Marx (2006) Introduction to Mathematical Statistics, 4th edition
% There are 12,000 residents in the area served by Shady Rest Hospital and
% the probability that a resident will have a heart attack and need a
% monitor is 1/8000. There are 3 monitors available. What is the
% probability that the 3 monitors will be inadequate to meet the
% community's needs? That is, what is the probability of 4 or more heart
% attacks?
% Written by Eugene.Gallagher@umb.edu, Fall 2010
fprintf('Solved as the sum of binomial probabilities: %8.6f\n',...
1-sum(binopdf(0:3,12000,1/8000)))
fprintf(...
'Or solved using the binomial cumulative distribution function: %8.6f\n',...
1-sum(binocdf(3,12000,1/8000)))
fprintf('Or solved using the Poisson distribution: %8.6f\n',...
1-sum(poisspdf(0:3,12000/8000)))
fprintf('Or solved using the cumulative Poisson distribution: %8.6f\n',...
1-sum(poisscdf(3,12000/8000)))