---
-title: "Week 6 Worked Examples"
+title: 'Week 6 problem set: Worked solutions'
+subtitle: "Statistics and statistical programming \nNorthwestern University \nMTS 525"
author: "Jeremy Foote"
date: "April 11, 2019"
output: html_document
## Programming Questions
-PC0. First we import the data.
+### PC0
+
+First we import the data.
```{r}
raw_df = read.csv("~/Desktop/DeleteMe/Teaching/owan03.csv") # Note that I saved the file as a CSV for importing to R
head(raw_df)
```
-PC1. Let's reshape the data
+### PC1
+Let's reshape the data
```{r}
library(tidyverse)
df <- df[complete.cases(df),]
```
-PC2: Now we're goint to get statistics and create some visualizations
+### PC2
+
+Now we're going to calculate summary statistics and create some visualizations
```{r}
mean(df$weeks_alive)
```
+### PC3
-PC3. Anova
-
+Anova!
```{r}
summary(aov(weeks_alive ~ dose, data = df))
This provides evidence that the group means are different.
-PC4. T-test between None and Any, and between None and High.
+### PC4
+
+T-test between None and Any, and between None and High.
```{r}
The Bonferroni correction is more conservative than it needs to be, ane there are other approaches; for example, the `TukeyHSD` function takes in an anova result and does post-hoc comparisons with corrections for all of the groups.
-
## Statistical Questions
Q1.