Now we will give an example of Bayesian inference in a more complicating setting. This example is based on a problem from pp. 588-591 of Introductory Statistics for Business and Economics by Wonnacott and Wonnacott.
Let us assume that there is a consumer electronics company named Banana, inc.. Banana sells iPood mp3 players. Banana, inc., however, has quality control problems and some of the truckloads of iPoods are defective. The proportion of defective iPoods in each truckload is as follows:
|Prior distribution of π|
|% Defective||Nbr. of Shipments||% of Shipments|
CircuitVillage recieves a truckload of iPoods from Banana, inc. They decide to take a random sample of n=5 iPoods out of the truckload in order to get sample evidence on π (the proportion defective in this truckload). CircuitVillage finds that 3 of the 5 iPoods are defective. What is the posterior distribution of π?
We can calculate the likelihood function using the binomial distribution. The binomial probability function is as follows:
|P(k out of n) =
We know that k=3 and n=5. And thus we can find the liklihood function that p=π.
|Calc. to obtain posterior dist.|
|Likelihood of Pi||Prior x Likelihood||Posterior|
Column 4 is found by simply plugging the first column value in for p into the binomial probability function where k=3 and n=5. Column 5 is found by multiplying column (3) by column (4). To normalize the distribution so that the probabilities sum to 1, we must divide by the sum of column five (0.161) and thus we have the posterior distribution.
We can ask ourselves what the probability is that less than 25% of the iPoods are defective in the shipment are defective. According to our prior, we would believe that 36% (.01 + .15 + .20) of the truckloads contain iPoods where less than 25% of them are defective. After collecting more information and observing that 3 of the 5 iPoods sampled are defective, our posterior distribution now says that it is less likely that the iPood shipment has a low defect rate. In fact, there is only a 7% chance (0 + 0.01 + 0.06) chance that less than 25% of the iPoods from Banana, inc. are defective according to our posterior.