HW 1
1
Ohmit et al. (2008) explores the vaccine efficacy of two competing influenza vaccines in a randomized controlled trial. In order to compute vaccine efficacy we need to compute the rate of illness in a placebo group against the rate of illness in the vaccinated group.
In the placebo group, there were 16 cases of symptomatic influenza confirmed by culture or by serologic analysis out of 338 total patients.
1.1
Model the positive influenza cases, \(y = 16\) as binomial with \(n = 338\) trials and unknown probability parameter \(\theta_p\). Use a Beta(1,1) prior. What is the posterior for \(\theta_p \mid y, n\)?
1.2
What is the posterior mean and variance of \(\theta\)? Report the result to 2 decimal places.
1.3
Give the 50%, 90%, and 95% equi-tailed posterior intervals, each reported to two decimal places.
1.4
Derive the posterior predictive distribution for a new trial with \(n = 400\) individuals. Make a histogram with \(1\times 10^4\) samples from the posterior predictive distribution for \(\tilde{y}\) in a new trial with \(400\) individuals with the following procedure:
- For \(s \text{ in } \{1, 2, \dots, 1e4\}\)
- Draw \(\theta^{(s)} \mid y \sim \text{Beta}(\alpha_n, \beta_n)\) where \(\alpha_n\) and \(\beta_n\) will depend on your data
- Draw \(\tilde{y} \mid \theta^{(s)}, n\) from a binomial distribution with \(400\) trials and a probability of success parameter \(\theta^{(s)}\)
1.5
Simulate 1e5 draws from the posterior you derived in 1.A using the rbeta function in R and plot a histgram of the draws
1.6
In the group that received the trivalent inactiatved vaccine, there were 19 cases of symptomatic influenza confirmed by culture or by serologic analysis out of 867 total patients.
Model the positive influenza cases, \(y = 19\) as binomial with \(n = 867\) trials and unknown probability parameter \(\theta_t\). Use a Beta(1,1) prior. What is the posterior for \(\theta_t \mid y, n\)?
1.7
Simulate 1e5 draws from the posterior you derived for \(\theta_t \mid y, n\) in 1.F
Simulate 1e5 draws from the posterior you derived for \(\theta_p \mid y, n\) in 1.E
Compute the vaccine efficacy (VE) by computing the following quantity for each draw \(\theta_p^{(s)}\) in steps 1 and 2 \(\theta_t^{(s)}\): \[ \text{VE}^{(s)} = 1 - \frac{\theta_t^{(s)}}{\theta_p^{(s)}} \]
Report the mean, variance and posterior equi-tailed 50%, 90%, and 95% posterior interval of the VE, each to two decimal places.
2
Consider the exponential family distributions for a random variable \(X \mid \eta\) of the form \[ p(x \mid \eta) = h(x) \exp\lp\eta x - A(\eta)\rp, \eta \in H, \] with support over \(\R\),
and a conjugate prior of the form, with support over \(H\):
\[ p(\eta \mid k, \mu) = c(k,\mu) \exp\lp k \eta \mu - k A(\eta)\rp \]
2.1
Derive the posterior distribution, up to a constant of proportionality for \(p(\eta \mid x, k, \mu)\)
2.2
Show that the conditional mean of \(X \mid \eta\) is equal to \(A'(\eta)\) and that the conditional variance of \(X \mid \eta\) is \(A''(\eta)\).
Hint: Calculate the log of the moment generating function of \(X \mid \eta\), \(\log \ExpA{e^{t X}}{X \mid \eta}\) and show that this is equal to \(A(\eta + t) - A(\eta)\).
2.3
Show that the implied marginal mean of \(X\) \(\Exp{X \mid k, \mu} = \ExpA{\Exp{X \mid \eta}}{\eta \mid k, \mu} = \mu\).
Hint: You may take the following fact about \(p(\eta \mid k, \mu)\) for granted:
\[ \int_{H} \frac{\partial}{\partial \eta} p(\eta \mid k, \mu) d\eta = \frac{\partial}{\partial \eta}\int_{H} p(\eta \mid k, \mu) d\eta \]
2.4
Show that the posterior mean for \(A'(\eta) \mid x, k, \mu\) is
\[ \ExpA{A'(\eta) \mid x, k, \mu}{\eta \mid x, k, \mu} = \frac{n \bar{x} + k \mu}{n + k} \]