# R program for paired t-test with cement data # 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) differences <- mod-unmod differences summary(differences) # perform paired t-test t.test(mod, unmod,paired=T) #Compare with a one-sample t-test on the differences t.test(differences) qqnorm(differences) qqline(differences) cor(sort(differences), qnorm((.5:9.5)/10))