load(url("http://www.rossmanchance.com/iscam3/ISCAM.RData"))
library(dplyr)
library(ggplot2)
library(readr)
homework at: http://www.rossmanchance.com/iscam3/instructors.html
Note that the ANOVA p-value comes from the following R code, page 333 of your text:
summary(aov(response~explanatory))
Robustness of ANOVA: http://shiny.stat.calpoly.edu/ANOVA_robust/
Simulate samples of size 20 from populations with equal means and standard deviations 6, 6, and 6. What is your Type I error rate?
Simulate samples of size 20 from populations with equal means and standard deviations 4, 6, and 8. Now what is your Type I error rate?
Simulate samples of size 20 from populations with equal means and standard deviations 1, 6, and 11. Now what is your Type I error rate?
Do the error rates you found in a, b, and c vary by sample size (when sample sizes are equal)? (That is, if the samples are still equal but much larger or much smaller, do you see the same variability in error rates?)
Next repeat your simulation study with sample sizes 10, 20, and 30. How do results differ?
Finally, repeat the above simulation studies, but specify population means to be -3, 0, and 3, so that you study the power of the test under different conditions. How does the power change with equal/unequal standard deviations and/or equal/unequal sample sizes?
Crash Tests
The National Transportation Safety Administration conducts crash tests on automobiles. The file crash.txt contains data on automobile crash tests in which stock automobiles are crashed into a wall at 35 miles per hour with dummies in the driver and front passenger seat (as reported by the Data and Story Library (DASL) web site, http://lib.stat.cmu.edu/DASL/Datafiles/Crash.html ). Response variables are measurements of injury extent on head (column 5), chest (column 6), left leg (column 7), and right leg (column 8). Explanatory variables include whether the dummy was on the driver or passenger side (column 9), protective devices in the car (column 10), number of doors on the car (column 11: 2, 4, or other), year of make (column 12), and size of car (column 14).
crashdata <- read.csv("http://pages.pomona.edu/~jsh04747/courses/math58/Math58Data/crashdata.csv", header=TRUE)
Comparing Means
Suppose that instructors A, B, and C are each teaching three large sections of a course, and each instructor wants to study whether the mean exam scores differ significantly across his/her three sections. Suppose that each takes a random sample of ten students, and calculates the following descriptive statistics:
*See the online HW for a better layout to this table of data:*
A1 A2 A3 B1 B2 B3 C1 C2 C3
Sample size 10 10 10 10 10 10 10 10 10
Sample mean 50 60 70 50 60 70 57 60 63
Sample std. dev. 24 24 24 5 5 5 5 5 5
hypoanova <- read_delim("http://www.rossmanchance.com/iscam2/data/HypoAnova.txt", "\t")
hypoanovaA <- hypoanova[1:30,]
hypoanovaB <- hypoanova[31:60,]
hypoanovaC <- hypoanova[61:90,]