clear all
close all
disp('CLT in Action: AVIO Company')
lw = 2;
set(0, 'DefaultAxesFontSize', 16);
fs = 15;
msize = 10;
% Avio Company.============================================
%Avio company sells 410 plane tickets for the flight at which physically
%only 400 seats are available. Find the probability that company
%overbooked the flight if a person who buys a ticket shows at the gate
%with probability of 0.96.
% the mean
meavio =410*0.96
% expected number of shows is 393.6000
% the std
stdavio = sqrt(410*0.96*0.04)
%theoretical std is 3.9679
1-normcdf((400.5-meavio)/stdavio) % 0.0410
%Notice that in this case the approximation is not very good
%since the exact probability is
exact = 1-binocdf(400, 410, 0.96)
%ans = 0.0329, which is big relative error (not absolute)
%It is interesting that the simulation gives better
%answer than the normal approximation
simu = sum(binornd(410, 0.96, 10000,1) > 400)/10000
%aa = 0.0313
%Better than the normal is the Poisson approximation,
% probability of overbooking is
% equal to probability of less than 9 noshows:
poisscdf(9, 0.04*410) %prob that 9 and less fail to show
%ans = 0.0355