---
title: "HW 3"
author: "Name here"
date: "Due Friday September 21, 2018"
output: html_document
---

Please use D2L to turn in both the PDF output and your R Markdown file.

### Q1. (20 pts) 
Consider $X \sim Binomial(N,\theta)$. Consider the uniform prior $p(\theta) = 1,$ where $0 \leq \theta \leq 1.$ The posterior sampling distribution should be clear. The prior that you have specified places an equal amount of weight on every possible value of p.

However, some people like to work with the log-odds, which we write as $\Lambda = \log \left( \frac{\theta}{1-\theta} \right).$

#### a. (5 pts)
Find $p(\Lambda)$. That is, find the pdf for $\Lambda$ (this is just a simple transformation problem).

#### b. (5 pts)	
Now, do the problem the other way around. Consider placing a uniform prior on $\Lambda$. That is let $p(\Lambda) \propto 1.$ What is the implied prior distribution on $\theta$?

#### c. (10 pts)
Reflect on the results in part a and part b. 

### Q2. (20 pts)
 (Hoff Exercise 3.3.) Tumor counts: A cancer laboratory is estimating the rate of tumorigenesis in two strains of mice, A and B. They have tumor count data for 10 mice in strain A and 13 mice in strain B. Type A mice have been well studied, and information from other labs suggests that type A mice have tumor counts that are approximately Poisson-distributed with a mean of 12. Tumor counts for type B mice are unknown, but type B mice are related to type A mice. The observed tumor counts for the two populations are:
\begin{eqnarray*}
\boldsymbol{y}_A &=& (12,9,12,14,13,13,15,8,15,6)\\
\boldsymbol{y}_B &=& (11,11,10,9,9,8,7,10,6,8,8,9,7)
\end{eqnarray*}

#### a. (10 pts)
Find the posterior distributions, means, variances, and 95% credible intervals for $\theta_A$ and $\theta_B$, assuming a Poisson sampling distribution for each group and the following prior distribution:
$$\theta_A \sim gamma(120,10), \theta_B \sim gamma(12,1)$$

#### b. (10 pts)
Compute and plot the posterior expectation for $\theta_B$ under the prior distribution $\theta_B \sim gamma(12\times n_0,n_0)$ for each value of $n_o \in \{1,2, ..., 50\}.$ Describe what sort of prior beliefs about $\theta_B$ would be necessary in order for the posterior expectation of $\theta_B$ to be close to that of $\theta_A$.

### Q3. (10 pts)
(Hoff Exercise 3.12) Jeffreys' prior: Jeffreys suggested a default rule for generating a prior distribution of a parameter $\theta$ in a sampling model $p(y|\theta)$. Jeffreys' prior is given by $p_j(\theta) \propto \sqrt{I(\theta})$, where $I(\theta) = -E[\delta^2 \log p(Y|\theta)/ \delta \theta^2|\theta]$ is the *Fisher information.*

Let $Y \sim binomial(n,\theta)$. Obtain Jeffreys' prior distribution $p_j(\theta)$ for this model.
