---
title: "Lab 7"
author: "Name here"
output: html_document
---

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

## Lab Exercise 1
### 1. (4 points) 
Simulate 100 responses from a Cauchy distribution, t distribution with $\mu$ = 1, $\sigma^2$=1 and $\nu=1$, and describe this data with a plot and brief description of the data.

### 2. (4 points) 
Use JAGS to fit a normal sampling model and the following priors for this data. 

 - $p(\mu) \sim N(0,10^2)$
 - $p(\sigma) \sim U(0,1000)$

Discuss the posterior HDIs for $\mu$ and $\sigma$.

### 3. (4 points) 
Use JAGS to fit a t sampling model and the following priors for this data. 

 - $p(\mu) \sim N(0,10^2)$
 - $p(\sigma) \sim U(0,1000)$
 - $p(\nu) \sim E_+(.1)$, where $E_+(.1)$ is a shifted exponential with rate = .1.

Discuss the posterior HDIs for $\mu$, $\sigma$, and $\nu$.


### 4. (4 points) 
Use the following code to create posterior predictive distributions for part 2 and part 3. Note: your data and coda objects may need to be renamed for this to work. Compare the data and the posterior predictive model curves with posterior predictive models. Note this is the final step in Bayesian data analysis: verifying that our model / prior selection is an accurate representation of the data. 


## Lab Exercise 2
Use the OK Cupid dataset and test the following claim, the mean height OK Cupid respondents reporting their body type as athletic is different than 70.5 inches (this value is arbitrary, but is approximately the mean height of all men in the sample). Interpret the results for each scenario.
```{r, message=FALSE}
okc <- read.csv('http://www.math.montana.edu/ahoegh/teaching/stat408/datasets/OKCupid_profiles_clean.csv', stringsAsFactors = F)
library(dplyr)
okc.athletic <- okc %>% filter(body_type == 'athletic' & sex == 'm')
```

1. (4 points)
Use `t.test()` with a two-sided procedure. 

2. (4 points)
Fit a Bayesian model for $\mu$ with a ROPE of $\pm$ .5 inch. Use the following priors: $p(\mu) \sim N(70.5, 10^2),$ $p(\sigma) \sim Unif(0,20)$, $p(\nu) \sim E_{+}(.1)$ and a t-sampling model.


3. (4 points)
Fit a Bayesian model for $\mu$ with a ROPE of $\pm$ .05 inch

