From: aaronshaw Date: Mon, 6 May 2019 02:51:05 +0000 (-0500) Subject: tweak X-Git-Url: https://code.communitydata.science/stats_class_2019.git/commitdiff_plain/50161569aabb14f5eda4e9a0643ee27f6843dac7?hp=d77163d23d116e6069bb89ce9be8c37d20d6d022 tweak --- diff --git a/problem_sets/week_06/ps6-worked-solution.Rmd b/problem_sets/week_06/ps6-worked-solution.Rmd index 986a9a0..23d9a77 100644 --- a/problem_sets/week_06/ps6-worked-solution.Rmd +++ b/problem_sets/week_06/ps6-worked-solution.Rmd @@ -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.