Description
1. Emily, Car, Stock Market, Sweepstakes, Vacation and Bayes.
Emily is taking
Bayesian Analysis course. She believes she will get an A with probability 0.6, a B with
probability 0.3, and a C or less with probability 0.1. At the end of semester she will get a
car as a present form her (very) rich uncle depending on her class performance.
For getting
an A in the course Emily will get a car with probability 0.8, for B with probability 0.5, and
for anything less than B, she will get a car with probability of 0.2. These are the probabilities
if the market is bullish. If the market is bearish, the uncle is less likely to make expensive
presents, and the above probabilities are 0.5, 0.3, and 0.1, respectively.
The probabilities
of bullish and bearish market are equal, 0.5 each. If Emily gets a car, she would travel to
Redington Shores with probability 0.7, or stay on campus with probability 0.3. If she does
not get a car, these two probabilities are 0.2 and 0.8, respectively. Independently, Emily
may be a lucky winner of a sweepstake lottery for a free air ticket and vacation in hotel Sol
at Redington Shores.
The chance to win the sweepstake is 0.001, but if Emily wins, she will
go to vacation with probability of 0.99, irrespective of what happened with the car.
Figure 1: Emily on the road
After the semester was over you learned that Emily is at Redington Shores.
(a) What is the probability that she got a car?
(b) What is the probability that she won the sweepstakes?
(c) What is the probability that she got a B in the course?
(d) What is the probability that the market was bearish?
Hint: You can solve this problem by any of the 3 ways: (i) use of WinBUGS or OpenBUGS, (ii) direct simulation using Octave/MATLAB, R, or Python, and (iii) exact calculation. Use just one of the three ways to solve it. WinBUGS/OpenBUGS or direct simulation
are recommended.
The exact solution, although straightforward, may be quite messy.
2. Trials until Fourth Success.
The number of failures until the fourth success in a
series of independent trials is observed in 11 independent experiments: 1 5, 2, 2, 0, 1, 4, 3,
1You may link this to your favorite story, like, on multiple occasions Larry Bird shoots from a distance
until he makes the 4th score, number of misses is counted
2
5, 0, 7, and 1.
You are interested in probability p of a success in a single trial. Assume that p is given
a beta prior with parameters
(a) a = b = 1;
(b) a = b = 1/2;
(c) a = 9, b = 1.
For each case (a)-(c) find:
Bayes estimator of p, the 95% credible set for p, and the posterior probability of hypothesis
H : p ≥ 0.8.
Hint: No WinBUGS should be used, the problem is conjugate. You will need Octave or R
or Python, to calculate beta cdf and quantiles.
3. Penguins.
A researcher is interested in testing whether the mean height of Emperor
penguins (Aptenodytes forsteri) from a small island is less than µ = 45 in., which is believed
to be the average height for the whole Emperor penguin population.
Figure 2: Emperor Penguins
The heights were measured of 14 randomly selected adult birds from the island with the
following results:
41 44 43 47 43 46 45 42 45 45 43 45 47 40
Assume that the measurements are normal N (µ, 1/τ ) where the parameter µ is given normal
prior N (45, 2
2
) and the precision parameter τ is given gamma Ga(4, 2) prior. The gamma
distribution is parameterized by scale parameter, in this case equal to 2.
Develop Gibbs Sampler that will sample from the posteriors for µ and τ .
Burn in fist 1000 simulations and simulate additional 10,000 µs and τ s. From the simulated values
(a) approximate the posterior probability of hypothesis that the researcher was interested
in, H0 : µ < 45;
(b) approximate the 95% credible set for parameter τ.
3