# R program with cement data in Table 2-1 # There are two easy ways to run these commands in R. One is to merely 'copy and paste' # these commands into R's 'Console window'. They will be executed automatically, and # you can then go back and see which commands resulted in what output. # A better way, in general, is to (within R) click on 'File -> New script', and then # copy and paste the commands into the script file that has opened up. With that # window highlighted, click on 'Edit -> Run all'. # You can save this script file, and run it again later, perhaps after making changes to it. # In doing assigned questions it is a good idea to put your commands into a script file, and # just keep running/changing/running the script file, until you get things right. That way, # once you get some of the commands right, you won't have to keep re-entering them. mod <- c(16.85, 16.40, 17.21, 16.35, 16.52, 17.04, 16.96, 17.15, 16.59, 16.57) unmod <- c(17.50, 17.63, 18.25, 18.00, 17.86, 17.75, 18.22, 17.90, 17.96, 18.15) cement <- data.frame(mod, unmod) cement # draw boxplot boxplot(mod,unmod) # perform two sample t-test (with equal variance assumption) t.test(mod,unmod,var.equal=TRUE) t.test(mod,unmod) #(Welsh approximation) # to check assumptions # normality check qqnorm(mod) qqline(mod,col=2) qqnorm(unmod) qqline(unmod,col=4) # equal variance var.test(mod,unmod)