【问题标题】:Interaction plot - coding fail for Two-way anova in R交互图 - R 中双向方差分析的编码失败
【发布时间】:2015-06-01 12:04:25
【问题描述】:

我正在尝试分析和呈现腹足类动物丰度与海岸高度和物种高度的双向方差分析结果。

这是数据集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)

【问题讨论】:

  • 这不起作用? interaction.plot(Gastropods$Zone, Gastropods$Species, Gastropods$sqrtAbundance, main= "Gastropod Interaction Plot", xlab = "Gastropod Zone", ylab= "Mean of SQRT Gastropod Abundance", legend = TRUE)
  • facepalm 哇。我发誓我试过了,但出错了……非常感谢你帮助我解决了我的极端菜鸟问题。另外,我想知道您是否可以帮助解释如何在条形图上标记误差线?我到处搜索,但没有提出任何建议。我完全是初学者。指向相关来源的链接甚至会很棒。再次感谢您。
  • 在绘图或条形图中使用 yaxt 或 xaxt ="n"。 Whit axis() 您可以根据需要标记轴。对于介绍性材料,可能是:introductoryr.co.uk/R_Resources_for_Beginners.html.
  • 我才来这里一两天,但这里的社区很棒。感谢您的帮助和链接。我被正式允许投票,所以我已经为你做了。再次感谢。

标签: r transformation interaction anova sqrt


【解决方案1】:

只是为了结束这个问题:

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

【讨论】:

    猜你喜欢
    • 2023-03-17
    • 1970-01-01
    • 2011-02-25
    • 2021-09-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-08-24
    相关资源
    最近更新 更多