关键词 > Statistics4224/5224

Statistics 4224/5224 Bayesian Statistics Fall 2022 Problem Set 5

发布时间:2022-11-29

Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit

Bayesian Statistics

Statistics 4224/5224 — Fall 2022

Problem Set 5

The following exercises are taken from A First Course in Bayesian Statistical Methods, by Peter D. Hoff.

1. The files school1 .dat through school8 .dat give weekly hours spent on homework for students sampled from eight different schools. Read the data in R by

y1  <- scan("http://www2 .stat .duke .edu/~pdh10/FCBS/Exercises/school1 .dat")

etc.  Letting Yi,j  denote the hours spent studying by the ith student of the jth school, model these data using the hierarchical normal model

Yi,j|θj,σ2 iid Normal(θj,σ2 )

for i = 1, . . . ,nj  for j = 1, . . . , 8, where

θ 1 , . . . ,θ8 |µ,τ2 iid Normal(µ,τ2 ) .

Construct p(σ2 ,µ,τ 2 ) as a product of independent semiconjugate priors,

σ 2 Inv-χ (ν20 = 1,σ0(2) = 15)

µ ∼ Normal(µ0 = 7,γ0(2) = 5)

τ 2 ∼ Inv-χ (η20 = 1,τ0(2) = 10)

(a) Run a Gibbs sampler to approximate the posterior distribution p(θ,σ2 ,µ,τ 2 |y1 , . . . , y8 ). Propose reasonable starting values and run the chain for S = 5000 iterations, and find the effective sample sizes for {σ2 ,µ,τ 2 }.

(b) Report posterior medians and 50% and 95% confidence intervals for {σ  ,µ,τ  };, that is,22  report the (.025, .25, .50, .75, .975)-quantiles for those three parameters.

(c) Compare the posterior densities to the prior densities for {σ  ,µ,τ  }, and discuss what was22  learned from the data.

(d) Use a density histogram to summarize the posterior distribution of R := τ2 /(σ2 + τ2 ) and compare it to the prior distribution of R. Describe the evidence for between-school variation.

(e) Quantify your prior and posterior belief that θ7  is smaller than θ6 , as well as your prior and posterior belief that θ7  is the smallest of all the θ’s.

(f) Generate S draws from the posterior predictive distribution of {1 , . . . , 8 }.  Obtain the posterior probability that 7  is less than 6 , as well as the posterior probability that 7  is the smallest of all the ’s. Clearly define the events to which these two probabilities apply.


2. The data file http://www2 .stat .duke .edu/~pdh10/FCBS/Exercises/glucose .dat contains plasma glucose concentration of 532 females from a study on diabetes.

(a) Make a histogram and kernel density estimate of the data.  Describe how this empirical distribution deviates from the shape of a normal distribution.

Consider the following mixture model for these data:  For each study participant there is an observed group membership variable zi, which is equal to 1 or 2 with probability λ and 1 − λ . If zi  = 1 then Yi  ∼ Normal(µ1 ,σ1(2)), and if zi  = 2 then Yi  ∼ Normal(µ2 ,σ2(2)).  Assume a jointly independent prior for (λ,µ1 ,µ2 ,σ1(2),σ2(2)), in which

λ ∼ Beta(a,b)

µj Normal(µ0 ,τ0(2))  for j = 1, 2

σj(2) ∼ Inv-χ (ν20 ,σ0(2))  for  j = 1, 2 .

(b) Obtain the full conditional distributions of (z1 , . . . ,zn), λ , µ 1 , µ2 , σ1(2)  and σ2(2) . Set a = b = 1, µ0 = 120, τ0(2) = 200, σ0(2) = 1000 and ν0 = 10.

(c) Implement the Gibbs sampler for at least S = 10,000 iterations.  At each iteration, switch the group labels, if necessary, so that µ1(s)  < µ2(s) for each s = 1, . . . ,S . Note that this requires switching σ s) with σs)  as well, and also change λs to 1 − λs . If you construct your Gibbs sampler to update z first, then there will be no need to switch the 1’s and 2’s in zs . In fact, there is really no need to even store zs .

i. Compute and plot the autocorrelation functions for µ1(s)  and µ2(s), as well as their effective sample sizes.

ii. Using the approximate posterior expectations of λ , µj  and σj(2) for j = 1, 2, describe your belief about the distribution of the glucose variable as a mixture of normal populations.

(d) For each iteration of the Gibbs sampler in part (c), sample a value = 1 or 2 with probability λs  and 1 − λs, respectively, then sample y˜s ∼ Normal(µ,σ(s)) .

i. Plot a histogram and kernel density estimate for the empirical distribution of {y˜1 , . . . , y˜S }, and compare it to the distribution in part (a).

ii. Discuss the adequacy of this two-component mixture model for the glucose data.