交互图 - R中的双向anova编码失败

时间:2015-06-01 12:04:25

标签: r transformation interaction anova sqrt

我试图通过双向方差分析来分析和呈现腹足类和腹足动物丰度与高度的结果。

这是数据集http://dropcanvas.com/ercb6

数据已经过sqrt转换,ANOVA测试成功。在下面的示例代码中,我能够绘制正常腹足类数据的交互图。但是,我想使用转换后的数据制作交互图,但我不知道如何更改代码以允许此操作。建议?

Gastropods = read.csv(file = "MaroubraZones.csv", header = TRUE)
boxplot(Abundance ~ Zone*Species,data = Gastropods, names = c("A.high", "A.mid", "A.low", "C.high", "C.mid", "C.low", "N.high", "N.mid", "N.low"))
Gastropods.ANOVA = aov(Abundance ~ Zone * Species, data = Gastropods)
hist(Gastropods.ANOVA$residuals)
plot(Gastropods.ANOVA)
summary(Gastropods.ANOVA)
Gastropods$sqrtAbundance = sqrt(Gastropods$Abundance +1)
Gastropods.aov = aov(Gastropods$sqrtAbundance ~ Zone + Species + Zone:Species, data = Gastropods)
summary(Gastropods.aov)

interaction.plot(Gastropods$Zone, Gastropods$Species, Gastropods$Abundance, main= "Gastropod Interaction Plot", xlab = "Gastropod Zone", ylab= "Mean of Gastropod Abundance", legend = TRUE)

1 个答案:

答案 0 :(得分:1)

刚刚结束这个问题:

interaction.plot(Gastropods$Zone, Gastropods$Species, Gastropods$sqrtAbundance, main= "Gastropod Interaction Plot", xlab = "Gastropod Zone", ylab= "Mean of SQRT Gastropod Abundance", legend = TRUE)