简体   繁体   English

R中的嵌套方差分析

[英]Nested Anova in R

I want to show that seeds of different species display different length due to the factor Species.我想表明,由于物种因素,不同物种的种子显示出不同的长度。 For each species, I have several trees and for each tree, I have several seeds measured.对于每个物种,我有几棵树,对于每棵树,我测量了几颗种子。

Using R, I did an ANOVA:使用 R,我做了一个方差分析:

summary(aov(Length ~ Species))

However, the reviewer noticed a problem of independence because seeds may provide from the same tree.然而,审稿人注意到了一个独立性问题,因为种子可能​​来自同一棵树。 (and this is indeed a real problem !) (这确实是一个真正的问题!)

To answer this issue, I think that I should do a nested ANOVA.为了回答这个问题,我认为我应该做一个嵌套方差分析。 Is that right ?那正确吗 ?

However, there are plenty of ways to write the code:但是,有很多方法可以编写代码:

summary(aov(Length ~ Species*Tree))
summary(aov(Length ~ Tree*Species))
summary(aov(Length ~ Species/Tree))
summary(aov(Length ~ Species+Error(Tree)))

I believe this is the last possibility listed that will allow me to show that the length of seeds is different due to the species and taking into account that the seeds may come from the same tree.我相信这是列出的最后一种可能性,它可以让我证明种子的长度因物种而异,并考虑到种子可能来自同一棵树。

Can you confirm ?你确定吗 ?

When I run the command, I obtain this:当我运行命令时,我得到这个:

Error: Tree
Df Sum Sq Mean Sq F value   Pr(>F)     
Species 12  320.6  26.715   14.98 4.96e-15 ***
Residuals  71  126.6   1.784                     
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 

Error: Within
Df Sum Sq  Mean Sq F value Pr(>F)
Residuals 1541  11.92 0.007733 

Which indeed means that species have a significative impact on the seed length, is that right ?这确实意味着物种对种子长度有重大影响,对吗?

Thanks so much for your help !!非常感谢你的帮助 !!

Muriel穆里尔

See here for some examples of nested ANOVA in R as well as some insight into mixed models.有关 R 中嵌套 ANOVA 的一些示例以及对混合模型的一些见解,请参见此处

I'd install the package lme4 , do ?lmer in R, and look into the section "Mixed and Multilevel Models" on the page provided.我会安装包lme4 ,在 R 中执行?lmer ,并查看提供的页面上的“混合和多级模型”部分。 Perhaps this is a better approach for your data.也许这对您的数据来说是一种更好的方法。

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

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