

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


Homework 2 Assigned 04/06/ Due 04/13/
(a) For p(θ) = 1, the uniform distribution, plot the curve p(θ) Pr(Y = 41|θ) for a dense, equally-spaced sequence of points in the interval [0,1]. (b) Plot the posterior distribution of θ|Y = 41. Compare this plot to the plot in (a), and discuss there similarities and differences to the two plots from homework 1. (c) As discussed in class, if θ ∼ beta(a, b), then θ|Y ∼beta(a+Y, b+n−Y ). Now let n 0 = a+b and μ 0 = a/(a+b). For each pair of μ 0 ∈ {. 1 ,. 2 ,... ,. 9 } and n 0 ∈ { 1 , 4 , 16 , 64 , 256 }, solve for the corresponding values of a and b and compute Pr(θ < .5) and Pr(θ <. 5 |Y = 41). (d) Plot your results from (c), using either the contour command in R, or with a separate plot for each value of n 0. (e) Suppose you are interested in comparing the rate of support in this county to that of another county. Suppose that a survey of sample size 25 was done in county 2, and the total number of people in the sample who supported the policy was 14. Identify the posterior distribution of θ 2 assuming a uniform prior and compare to the plot in (b). Also compare the posterior means, modes and standard deviations for each county. (f) Sample 5000 or more values of each of θ 1 and θ 2 from their posterior distributions using the rbeta command in R. From these samples, estimate P (θ 1 < θ 2 |the data and prior).
(a) Identify the posterior distribution of θ given data (Y 1 , X 1 ),... , (Yn, Xn) and a gamma(a, b) prior distribution.
The file cancer_react.dat contains 1990 population sizes (in 10,000’s) and number of breast- cancer fatalities for 10 counties in a midwestern state that are near nuclear reactors. The file cancer_noreact.dat contains the same data on counties in the same state that are not near nuclear reactors. Consider these data as samples from two populations of counties, one is the population of counties with no neighboring reactors and a fatality rate of θ 1 deaths per 10,000, and the other is a population of counties having nearby reactors and a fatality rate of θ 2. Consider comparisons of θ 1 and θ 2 as follows: Model beliefs about the rates as θ 1 ∼ gamma(a 1 , b 1 ), θ 2 ∼ gamma(a 2 , b 2 ), and θ 1 and θ 2 are independent.
(b) Using the numerical values of the data, identify the posterior distributions for θ 1 and θ 2 for any values of (a 1 , b 1 , a 2 , b 2 ).
(c) Suppose cancer rates from previous years has been roughly θ˜ = 2.2 per ten-thousand (and note that most counties are not near reactors). For each of the following three prior opinions, compute E(θ 1 |data), E(θ 2 |data), 95% quantile-based posterior intervals for θ 1 and θ 2 , and Pr(θ 2 > θ 1 |data). Put these results into a table. Also plot the posterior densities (try to put p(θ 1 |data) and p(θ 2 |data) on the same plot). Comment on the differences across posterior opinions. i. Opinion 1: (a 1 = a 2 = 2. 2 × 100 , b 1 = b 2 = 100). Cancer rates in this year are similar to rates in previous years and there is no information distinguishing reactor from nonreactor counties. ii. Opinion 2: (a 1 = 2. 2 × 100 , b 1 = 100, a 2 = 2. 2 , b 1 = 1). Cancer rates in this year for nonreactor counties are similar to rates in previous years in nonreactor counties. We don’t have much info on reactor counties, but perhaps the rates are close to those observed previously in nonreactor counties. iii. Opinion 3: (a 1 = a 2 = 2. 2 , b 1 = b 2 = 1). Cancer rates in this year could be different from rates in previous years, for both reactor and nonreactor counties.
(*) In the above analysis we assumed that population size gives no information about fatality rate. Is this reasonable? How would the analysis have to change if this is not reasonable?
(*) We encoded our beliefs about θ 1 and θ 2 such that they gave no information about each other (they were a priori independent). Think about why and how you might encode beliefs such that they were a priori dependent.