# ReadingIndep Example -- reading-indep.R source code. # Read data from input file. scores <- read.table("reading-indep.txt", header=TRUE) std <- scores$Score[scores$Method == "STD"] new <- scores$Score[scores$Method == "NEW"] # Print data. cat("Scores of students taught by standard teaching method:\n") print(std) cat("Score of students taught by new teaching method:\n") print(new) # Perform independent two-sample t-test, assuming equal variances. ttest <- t.test(std, new, alternative="two.sided", paired=FALSE, var.equal=TRUE, conf.level=0.95) print(ttest) # Perform independent two-sample t-test, not assuming equal variances. ttest <- t.test(std, new, alternative="two.sided", paired=FALSE, var.equal=FALSE, conf.level=0.95) print(ttest) # Perform F-test to test null hypothesis that variances # of two methods are the same. vartest <- var.test(std, new) print(vartest)