library(reshape2) DF = read.table('../../Data/ASCII_Comma/Chapter_12/fsh.txt', sep=',', quote='\'', header=TRUE) DF$Untreated = DF$Untreated.Serum - DF$No.Serum DF$PEG = DF$PEG.Serum - DF$No.Serum DF$FDose = as.factor(DF$Dose * 100) DF_melt = melt( DF[, c('FDose','Untreated','PEG')], id.vars='FDose', variable.name='Treatment', value.name='Underperformance') # Consider a model with an interaction and one without: # fit = aov(Underperformance ~ FDose * Treatment, data=DF_melt) print(summary(fit)) fit = aov(Underperformance ~ FDose + Treatment, data=DF_melt) print(summary(fit)) #postscript("../../WriteUp/Graphics/Chapter12/prob_35_interactionplot.eps", onefile=FALSE, horizontal=FALSE) interaction.plot(DF_melt$FDose, DF_melt$Treatment, DF_melt$Underperformance, type='b', col=c('red','blue'), pch=c(16, 18), xlab='Dose', ylab='Underperformance', main='Interaction between Underperformance and Treatment') #dev.off()