如果要做的话,在公式里面写出来就可以了。A*B表示因素A和B还有它们的交互作用都包括在分析里,如果要单独写出来交互作用要用A:B。
如果要画出来的话,interaction.plot()可以作出交互效应图,考查因素之间交互作用是否存在, 比如
> op<-par(mfrow=c(1, 2))
> plot(Time~Toxicant+Cure, data=rats)
> with(rats, interaction.plot(Toxicant, Cure, Time, trace.label="Cure"))
> with(rats,interaction.plot(Cure, Toxicant, Time, trace.label="Toxicant"))
说明是:
Use box plots and line plots to visualize group differences. There are also two functions specifically designed for visualizing mean differences in ANOVA layouts. interaction.plot( ) in the base stats package produces plots for two-way interactions.