Question
I need ans in R 6.2 Mixture model: The file glucose.dat contains the plasma glucose concentration of 532 females from a study on diabetes (see
I need ans in R
6.2 Mixture model: The file glucose.dat contains the plasma glucose concentration of 532 females from a study on diabetes (see Exercise 7.6). a) Make a histogram or kernel density estimate of the data. Describe how this empirical distribution deviates from the shape of a normal distribution.
b) Consider the following mixture model for these data: For each study participant there is an unobserved group membership variable Xi which is equal to 1 or 2 with probability p and 1 - p. If Xi = 1 then Yi ~ normal(?1, s2 1 ), and if Xi = 2 then Yi ~ normal(?2, s2 2 ). Let p ~ beta(a, b), ?j ~ normal(0, t 2 0 ) and 1/sj ~ gamma(?0/2, ?0s 2 0/2) for both j = 1 and j = 2. Obtain the full conditional distributions of (X1, . . . , Xn), p, ?1, ?2, s 2 1 and s 2 2 . c) Setting a = b = 1, 0 = 120, t 2 0 = 200, s 2 0 = 1000 and ?0 = 10, implement the Gibbs sampler for at least 10,000 iterations. Let ? (s) (1) = min{? (s) 1 , ?(s) 2 } and ? (s) (2) = max{? (s) 1 , ?(s) 2 }. Compute and plot the autocorrelation functions of ? (s) (1) and ? (s) (2), as well as their effective sample sizes. d) For each iteration s of the Gibbs sampler, sample a value x ~ binary(p (s) ), then sample Y? (s) ~ normal(? (s) x , s 2(s) x ). Plot a histogram or kernel density estimate for the empirical distribution of Y? (1) , . . . , Y? (S) , and compare to the distribution in part a). Discuss the adequacy of this two-component mixture model for the glucose data
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started