######################################## # # Script: 27 January 2011 (20110127.R) # ######################################## # Today: # # ** Analysis of Variance # # But, before we do that, let us look at these lines from last time. fball <- read.csv("http://courses.kvasaheim.com/stat40x3/data/ncaa2009football.csv", header=TRUE) boxplot(score~conference, data=fball) model1 <- aov(score~conference, data=fball) summary(model1) model2 <- kruskal.test(score~conference, data=fball) print(model2) # Note the differences in how these are 'called' from what we have done in the past. # I saved the results in a variable, then called the summary function to give me a lot # of information for the aov model and a print to get the information from the # Kruskal-Wallis test model. # The standard is to have the summary() function give more information than the print() # function. The aov() function follows this convention. The kruskal.test() function # violates it. # We save the model results into variables in order to extract information from the model. # Typical bits of information include the coefficients, which we can get from model1 by model1$coefficients # These are the 'effects' of each of the categories # and the p-values, which we get from model2 by model2$p.value # Where do we get a list of the information we can extract? Place 1 is the help page, the # 'Values' section tells us. Alternatively, the names() function will also tell us names(model1) names(model2) # Get into the habbit of saving the model results in a variable; it will help in the future.