library(reshape2) library(gplots) DF_male = read.csv('../../Data/ASCII_Comma/Chapter_12/lhmale.txt', quote='\'') DF_female = read.csv('../../Data/ASCII_Comma/Chapter_12/lhfemale.txt', quote='\'') DF = rbind( DF_male, DF_female ) # both DF = DF_male # just male #DF = DF_female # just female DF_melt = melt(DF, id.vars=c('Dose'), variable.name='Light', value.name='LH') DF_melt$Dose = as.factor(DF_melt$Dose) DF_melt$Light = as.factor(DF_melt$Light) fit = aov(LH ~ Dose * Light, data=DF_melt) print(summary(fit)) #postscript("../../WriteUp/Graphics/Chapter12/prob_23_interactionplot.eps", onefile=FALSE, horizontal=FALSE) interaction.plot(DF_melt$Dose, DF_melt$Light, DF_melt$LH, type='b', col=c('red', 'blue'), pch=c(16, 18), main='Interaction between Dose and Light') #dev.off() if( FALSE ){ library(gplots) attach(DF_melt) plotmeans(LH ~ interaction(Dose, Light, sep=' '), connect=list(seq(1, 5), seq(6, 10)), col=c('red', 'darkgreen')) } #library(HH) #interaction2wt(LH ~ Dose * Light)