简体   繁体   English

交互作用图-R中双向方差分析的编码失败

[英]Interaction plot - coding fail for Two-way anova in R

I am trying to analyse and present the results of Gastropod abundance vs. height on the shore and species in a Two-Way ANOVA. 我正在尝试通过双向方差分析分析和介绍腹足纲动物的丰度与岸上和物种高度的关系。

This is the dataset http://dropcanvas.com/ercb6 这是数据集http://dropcanvas.com/ercb6

The data has been sqrt transformed and an ANOVA test was successful. 数据已进行sqrt转换,并且方差分析测试成功。 In my sample code below I was able to make an interaction plot of the normal Gastropod data. 在下面的示例代码中,我能够绘制出正常腹足纲动物数据的相互作用图。 However, I want to make an interaction plot using the transformed data but I do not know how to alter the code to allow this. 但是,我想使用转换后的数据绘制一个交互图,但是我不知道如何更改代码以允许这样做。 Suggestions? 建议?

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)

只是为了结束问题:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM