Question: Help with code in R/Python 3. Gibbs and High/Low Protein Diet in Rats. Armitage and Berry (1994, p. 111) report data on the weight gain

Help with code in R/Python

Help with code in R/Python 3. Gibbs and High/Low Protein Diet in

3. Gibbs and High/Low Protein Diet in Rats. Armitage and Berry (1994, p. 111) report data on the weight gain of 19 female rats between 28 and 84 days after birth. The rats were placed on diets with high (12 animals) and low (7 animals) protein content. High protein Low protein 134 70 146 118 104 101 119 85 124 107 161 132 107 94 83 113 129 97 123 We want to test the hypothesis on dietary effect. Did a low protein diet result in signifi- cantly lower weight gain? The classical t test against one sided alternative will be significant. We will do the test Bayesian way using Gibbs sampler. Assume that high-protein diet measurements yl, i = 1, ..., 12 are coming from normal distribution N(01, 1/71), where 71 is precision parameter, f (yli |01, 71) x 71 2 exp - 2 ( y1i - 01)2 ), i = 1,..., 12. Low-protein diet measurements y2, i = 1, . .., 7 are coming from normal distribution N(02, 1/T2) f (yz: | 02, 72) xx 12 2 expl - 2 (3zi - 02)2 ), i = 1, ..., 7. Assume that 01 and 02 have normal priors (010, 1/710) and N(020, 1/720), respectively. Take prior means as 010 = 020 = 110 (apriori no preference) and precisions as 710 = 720 = 1/100. Assume that 1 and 72 have the gamma ga(al, b2) and Ga(a2, b2) priors with shapes a1 = Q2 = 0.01 and rates b1 = b2 = 4. (a) Construct Gibbs sampler that will sample 01, 71, 02, and 72 from their posteriors. (b) Find sample differences 01 - 02 . Proportion of positive differences approximates posterior probability of hypothesis Ho : 01 > 02. What is this proportion? (c) Using sample quantiles find the 95% equitailed credible set for 01 - 02. Does this set contain 0

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Mathematics Questions!