# read in Reading dataset # either with Import dataset or read.csv() fourthgr=read.csv('https://webpages.uidaho.edu/~renaes/Data/4threading.csv', header=T) attach(fourthgr) # Make a histogram hist(Speed,main="Histogram of Reading speed") hist(Comp,main="Histogram of Reading comprehension",xlab="Comprehension") # Summary statistics # Basic descriptive statistics # install.packages("pastecs") library(pastecs) stat.desc(Speed) library(stargazer) stargazer(fourthgr,type='text') # or just use t.test with no mu specified (not needed for CI only) # 95% CI t.test(Speed) # 90% Ci t.test(Speed,conf.level=.90) 99% CI t.test(Speed,conf.level=.99) # hypothesis test: # Reading speed in 4th graders is usually around 8.5 minutes. # We took a random sample of 20 4th graders and the sample # mean was 9.1 with standard deivation of 2.57. Is there sufficient # evidence that the reading speed for these 4th graders is higher # than average (slower reading times)? (assume alpha = 0.05) # H0: mu = 8.5 Ha: mu > 8.5 # assumptions: random (yes), independence (yes because random), roughly normal mu0=8.5 t.test(Speed,mu=8.5,alternative='l') # for test t.test(Speed) # for CI