feed.data=read.table(".../feederfloor.txt",header=TRUE) attach(feed.data) #two-way with interactions model.interaction=aov(weight~floor+trough+floor:trough) summary(model.interaction) #two-way without interactions (main effects only): model.main=aov(weight~floor+trough) summary(model.main) #or, to get standard errors for the main effects, use summary.lm summary.lm(model.main) #you can compute the means for each treatment: mu.HH=mean(weight[(floor=="H")&(trough=="H")]) mu.HL=mean(weight[(floor=="H")&(trough=="L")]) mu.LH=mean(weight[(floor=="L")&(trough=="H")]) mu.LL=mean(weight[(floor=="L")&(trough=="L")]) #compute mean for High Floor - Low Floor groups mean(weight[floor=="H"])-mean(weight[floor=="L"]) #compute mean for High Feeder - Low Feeder groups mean(weight[trough=="H"])-mean(weight[trough=="L"]) #second example #first modify the data, as dscribed by the problem: weight[(floor=="H")&(trough=="L")]=weight[(floor=="H")&(trough=="L")]-8 #then fit the model with interaction model2.interaction=aov(weight~floor+trough+floor:trough) summary(model2.interaction)#--->strong interaction effect summary.lm(model2.interaction) #to get sigma hat: sigma.hat=sqrt(summary(model2.interaction)[[1]][4,3]) #to answer specific questions based on linear combinations: #compare means of low and high floor when trough is low mean(weight[(floor=="H")&(trough=="H")])-mean(weight[(floor=="L")&(trough=="H")]) #to compute standard error of this linear combination: sigma.hat*sqrt(1/10+1/10)#n1=n2=10 in this case