Chapter 7 Exercises
Asthma
Solutions
In Example 7.2.1 (Asthma) instead of using BUGS to automatically sample from the conjugate Dirichlet posterior, determine this posterior explicitly, and
a) calculate the posterior mean of each probability analytically
b) calculate the posterior mean of each probability by Monte Carlo sampling in BUGS.
making sure they match the values presented in Example 7.2.1.
c) Suppose everybody begins in state 1. In BUGS, define a matrix s[i,j] of the proportions in state j at subsequent weeks i, and use a ``for'' loop and ``inprod'' to update its values at each week by multiplying by the relevant part of the matrix of transition probabilities. Thus estimate the expected proportions of people in each state after 12 weeks.
a)
Click arrow for solution
b)
Click arrow for solution
c)
Click arrow for solution