--- title: "HW 4" author: "Name here" date: "Due Friday September 28, 2018" output: html_document --- Please use D2L to turn in both the PDF output and your R Markdown file. ### Q1. (25 pts) For this question, consider modeling bat counts using a Poisson distribution as a sampling model. #### a. Prior (5 pts) Select and justify a prior for this setting. #### b. Posterior (10 pts) Using nightly bat counts recorded over a two week period (below), compute a posterior distribution for the mean term in the Poisson distribution. ```{r} bat.counts <- c(3,3,92,101,54,5,28,2,0,0,6,0) ``` Please formally write out this distribution and create a figure to visualize the distribution. ### c. Posterior Predictive Distribution (10 pts) Create and plot your posterior predictive distribution. Use this to compute: - The probability of new observation in the interval [20, 30] - The probability of a new observation equal to 2. Now do a posterior predictive check by comparing your posterior predictive distribution with the observed data. Please indicate and justify whether you feel your model is adequate. ### Q2. After enjoying numerous Bridger Bowl powder days during your time at MSU, you have received a job offer in New Mexico. You decision hinges on the quality of snow at your potential new home mountain, Taos. According to [https://www.onthesnow.com/new-mexico/taos-ski-valley/historical-snowfall.html](https://www.onthesnow.com/new-mexico/taos-ski-valley/historical-snowfall.html) annual snowfall totals can be obtained. Below are the snowfall totals for Taos and Bridger Bowl for the last nine years. ```{r} taos <- c(78,192,169,179,191,204,197,116,195) bridger <- c(271,209,228,166,316,254,344,319,247) ``` Specifically the BSF is interested in computing three probabilistic statements. 1. $Pr[\theta_{bridger} > \theta_{taos}]$ where $\theta_{bridger}$ is the mean annual snow fall at Bridger Bowl and $\theta_{taos}$ is the mean annual snow fall at Taos. 2. $Pr[\theta_{bridger} > 250]$ 3. $Pr[\theta_{taos} > 200]$ #### a. (5 pts) How would you go about addressing the questions in a classical framework? Would you be able to compute these probabilities? #### b. (20 pts) Using the prior structure where $p(\sigma_{bridger}^2,\theta_{bridger}) = p(\theta_{bridger}|\sigma_{bridger}^2) p(\sigma_{bridger}^2)$ and $p(\sigma_{taos}^2,\theta_{taos}) = p(\theta_{taos}|\sigma_{taos}^2) p(\sigma_{taos}^2)$ compute the marginal posterior distributions $p(\theta_{bridger}|y_{{bridger},1}, \dots, y_{{bridger},15})$ and \\$p(\theta_{taos}|y_{{taos},1}, \dots, y_{{taos},9})$, where $\sigma_1^2$ and $\sigma_{taos}^2$ are the variances for snowfall (in inches) a, and $y_{i,j}$ is the observed snowfall at location $i$ for reading $j$. Then using posterior samples from each distribution compute the three values specified above.