## Healthcare Economist

Unbiased Analysis of Today's Healthcare Issues

## Bayesian Inference II

Written By: Jason Shafrin - Mar• 09•07

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 (1) (2) (3) 0% 2 1% 10% 30 15% 20% 40 20% 30% 42 21% 40% 34 17% 50% 26 13% 60% 16 8% 70% 8 4% 80% 2 1% 90% 0 0% 100% 0 0% 200 100%

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) = n! k!(n-k)! (pk)((1-p)n-k)

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 (1) (4) (5) (6) 0% 0.000 0.000 0.000 10% 0.008 0.001 0.008 20% 0.051 0.010 0.064 30% 0.132 0.028 0.172 40% 0.230 0.039 0.243 50% 0.313 0.041 0.252 60% 0.346 0.028 0.172 70% 0.309 0.012 0.077 80% 0.205 0.002 0.013 90% 0.073 0.000 0.000 100% 0.000 0.000 0.000 0.161 1.000

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.

You can follow any responses to this entry through the RSS 2.0 feed. Responses are currently closed, but you can trackback from your own site.