1
0
This commit is contained in:
aaronshaw
2019-05-05 21:51:05 -05:00
parent d77163d23d
commit 50161569aa

View File

@@ -1,5 +1,6 @@
---
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
@@ -11,15 +12,18 @@ knitr::opts_chunk$set(echo = TRUE, messages = F)
## 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)
@@ -40,7 +44,9 @@ df$dose <- as.factor(df$dose)
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}
@@ -103,9 +109,9 @@ The global mean is
mean(df$weeks_alive)
```
### PC3
PC3. Anova
Anova!
```{r}
summary(aov(weeks_alive ~ dose, data = df))
@@ -113,7 +119,9 @@ 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}
@@ -143,7 +151,6 @@ These t-tests both support the idea that receiving a dose of RD40 reduces lifesp
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.