tweak
This commit is contained in:
@@ -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"
|
author: "Jeremy Foote"
|
||||||
date: "April 11, 2019"
|
date: "April 11, 2019"
|
||||||
output: html_document
|
output: html_document
|
||||||
@@ -11,15 +12,18 @@ knitr::opts_chunk$set(echo = TRUE, messages = F)
|
|||||||
|
|
||||||
## Programming Questions
|
## Programming Questions
|
||||||
|
|
||||||
PC0. First we import the data.
|
### PC0
|
||||||
|
|
||||||
|
First we import the data.
|
||||||
|
|
||||||
```{r}
|
```{r}
|
||||||
raw_df = read.csv("~/Desktop/DeleteMe/Teaching/owan03.csv") # Note that I saved the file as a CSV for importing to 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)
|
head(raw_df)
|
||||||
```
|
```
|
||||||
|
|
||||||
PC1. Let's reshape the data
|
### PC1
|
||||||
|
|
||||||
|
Let's reshape the data
|
||||||
|
|
||||||
```{r}
|
```{r}
|
||||||
library(tidyverse)
|
library(tidyverse)
|
||||||
@@ -40,7 +44,9 @@ df$dose <- as.factor(df$dose)
|
|||||||
df <- df[complete.cases(df),]
|
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}
|
```{r}
|
||||||
|
|
||||||
@@ -103,9 +109,9 @@ The global mean is
|
|||||||
mean(df$weeks_alive)
|
mean(df$weeks_alive)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### PC3
|
||||||
|
|
||||||
PC3. Anova
|
Anova!
|
||||||
|
|
||||||
```{r}
|
```{r}
|
||||||
summary(aov(weeks_alive ~ dose, data = df))
|
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.
|
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}
|
```{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.
|
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
|
## Statistical Questions
|
||||||
|
|
||||||
Q1.
|
Q1.
|
||||||
|
|||||||
Reference in New Issue
Block a user