############################## # # Script: assignment01a.R # Answers to the first # homework assignment # ############################## # Read in the data ht <- read.csv("http://courses.kvasaheim.com/pols6123/data/studentHeight.csv") names(ht) summary(ht) attach(ht) ##### # Problem 1 boxplot(height~sex, las=1, xlab="Gender", ylab="Height (in)") t.test(height~sex, alternative="greater") ##### # Problem 2 # Check assumption of Normality using boxplots boxplot(height~sex, las=1, xlab="Gender", ylab="Height (in)") # or using histograms hist(height[sex=="Male"]) hist(height[sex=="Female"]) # or using the Shapiro-Wilk test shapiro.test(height[sex=="Male"]) shapiro.test(height[sex=="Female"]) # in each of these, Normality seems reasonable t.test(height~sex, alternative="greater")