March 29 550.413 Section # Number 2 on handout Distribution <- read.table("C:/413/CH16PR12.txt", header=F) Distribution <- edit(Distribution) # col1=NumDays, col2=Agent, col3=TransNum attach(Distribution) #attach the new columns names to the dataset Agent = as.factor(Agent) #tells R that this variable is categorical, not numeric #(a) plot(Agent,NumDays) # method 1 to make boxplot boxplot(NumDays~Agent) # method 2 to make boxplot plot(as.numeric(Agent),NumDays) # dot plot aov_1 = aov(NumDays~Agent) #(b) and (c) y_hat=aov_1$fitted.values y_hat resids=round(aov_1$residuals,2) resids data.frame(NumDays,y_hat=aov_1$fitted.values,resids=round(aov_1$residuals,2)) #(d) anova(aov_1) #(e) TukeyHSD(aov_1,"Agent",conf.level=0.90) # Number 3 on handout plot(as.numeric(Agent),resids) qqnorm(resids) detach(Distribution)