## Tuesday, March 30, 2010

### Poisson and airline reservations

In the problems for Chapter 5.1, Grinstead and Snell have the following:

An airline finds that 4 percent of the passengers that make reservations on a particular flight will not show up. Consequently, their policy is to sell 100 reserved seats on a plane that has only 98 seats. Find the probability that every person who shows up for the flight will find a seat available.

Attempt #1:
Each seat that is sold is a Bernoulli trial with Prob(no-show) = 0.04.

N = 100, so the expected number of no-shows for a flight = N p = 4.
The variance is N p (1-p) = 3.84, sd = 1.95

If the number of no-shows exceeds ≈ 1 sd, there won't be a seat for someone.
I expect this to happen about 0.5*e-1 of the time = 0.18.
The desired probability is 1 minus this.

The problem with this is that no-shows are not normally distributed!

Attempt #2:

If we use the Poisson approximation we have

 `P = λk / k! e-λlambda = 4P(0 no-show) = e-4 = 0.018P(1 no-show) = 4 * 0.018 = 0.073P(nobody gets bumped) = 1 - 0.073 - 0.018 = 1 - 0.091 = 0.919`

Attempt #3 is a simulation (Python code below.
Note the number of seats simulated is 108 !).
The program prints the probability that no one gets bumped, and the st dev for the simulated values.

 `\$ python problem28.py 0.087023 0.00877316767194`

 `import numpy as npimport randomdef overbooked(): rL = list() for i in range(100): if random.random() > 0.96: pass else: rL.append(1) return sum(rL) > 98N = 1000L = list()for i in range(1000): S = sum([overbooked() for i in range(N)]) L.append(S*1.0/N)A = np.array(L)print np.mean(A), np.std(A)`

#### 1 comment:

sanam arzoo said...

I really really like studying and following your publish as I discover them incredibly useful and exciting. This publish is similarly useful as well as exciting . Thank you for details you been placing on creating your website such an exciting. I provided something for my details. Airline Reservation