Bayesian Data Analysis

Bayesian Data Analysis

Problem 1. BDA Chapter 4, Exercise 15.
15. Coverage of posterior intervals:
(a) Consider a model with scalar parameter A. Prove that, if you draw A from the prior,
draw y|0 from the data model, then perform Bayesian inference for O given y, that
there is a 50% probability that vour 50% interval for O contains the true value.
(b) Suppose A ~ N(0, 22) and y0 ~ N(0, 1). Suppose the true value of O is 1. What is the
coverage of the posterior 50% interval for 0? (You have to work this one out: it’s not
50% or any other number you could just guess.)
(c) Suppose A ~ N(0,22) and y|0 ~ N(0,1). Suppose the true value of O is do. Make a
plot showing the coverage of the posterior 50% interval for A, as a function of 00.
Problem 2. BDA Chapter 5, Exercise 12.
12. Conditional posterior means and variances: derive analytic expressions for E(O;|T, y) and
var (0;|, y) in the hierarchical normal model (and used in Figures 5.6 and 5.7). (Hint:
use (2.7) and (2.8), averaging over p.)
Problem 3. BDA Chapter 5, Exercise 13. Data to this problem are displayed in Table 3.3 on page 81. You’re
only modeling data from the
“residential streets labeled as bike routes”, i.e. the first two rows.

13. Hierarchical binomial model: Exercise 3.8 described a survey of bicycle traffic in Berkeley,
California. with data displaved in Table 3.3. For this problem. restrict vour attention to
the first two rows of the table: residential streets labeled as ‘bike routes.” which we will
use to illustrate this computational exercise.
(a) Set up a model for the data in Table 3.3 so that, for j=1..
., 10, the observed number
of bicycles at location j is binomial with unknown probability A; and sample size equal
to the total number of vehicles (bicycles included) in that block. The parameter A;
can be interpreted as the underlying or *true’ proportion of traffic at location j that is
bicycles. (See Exercise 3.8.) Assign a beta population distribution for the parameters
8; and a noninformative hyperprior distribution as in the rat tumor example of Section
5.3. Write down the joint posterior distribution.
(b) Compute the marginal posterior density of the hyperparameters and draw simulations
from the joint posterior distribution of the parameters and hyperparameters, as in
Section 5.3.
(c) Compare the posterior distributions of the parameters 0; to the raw proportions,
(number of bicycles / total number of vehicles) in location j. How do the inferences
from the posterior distribution differ from the raw proportions?
(d) Give a 95% posterior interval for the average underlying proportion of traffic that is
(e) A new city block is sampled at random and is a residential street with a bike route. In
an hour of observation, 100 vehicles of all kinds go by. Give a 95% posterior interval
for the number of those vehicles that are bicycles. Discuss how much vou trust this
interval in application.
(f) Was the beta distribution for the A;’s reasonable?
Problem 4. BA Chapter 5, Exercise 14. This question concerns the same dataset as Exercise 13.
14. Hierarchical Poison model: consider the dataset in the previous problem, but suppose
onlv the total amount of traffic at each location is observed
(a) Set up a model in which the total number of vehicles observed at each location
follows a Poison distribution with parameter Aj, the ‘true’ rate of traffic per hour at
that location. Assign a gamma population distribution for the parameters A; and a
noninformative hvperprior distribution. Write down the joint posterior distribution
(b) Compute the marginal posterior density of the hyperparameters and plot its contours.
Simulate random draws from the posterior distribution of the hyperparameters and
make a scatterplot of the simulation draws.
(c) Is the posterior density integrable? Answer analytically by cxamining the joint pos-
terior density at the limits or empirically by examining the plots of the marginal
posterior densitv above.
(d) If the posterior density is not integrable, alter it and repeat the previous two steps.
(e) Draw samples from the joint posterior distribution of the parameters and hyperpa
rameters, by analogy to the method used in the hierarchical binomial model