正态性检验和双向aov预测器的不同顺序

时间:2018-02-18 19:57:03

标签: r anova

我的数据如下所示:

Location=c("lcn","lcn","lcn","etb","lcs","bbs","lcn","lcs","bbs","lcn","lcs","bbs","lcs","lcs","lcn",
"bbs","etb","bbs","etb","etb","lcs","lcn","lcn","bbs","bbs","etb","bbs","etb","bbs","bbs",
"lcs","lcs","lcs","lcs","lcs","lcn","lcs","etb","lcn","lcn","etb","etb","etb","etb","lcn",
"bbs","bbs","lcs","etb","lcs","bbs","bbs","lcs","bbs","lcs","lcn","lcn","lcn","etb","lcn",
"lcs","bbs","etb","etb","etb","bbs","etb","bbs","etb","etb","bbs","lcs")

Treatment=c(rep("control",each=21),rep("foam",each=20),rep("hail",each=17),rep("teda",each=14))

Growth=c( 0.24, -0.05,  0.19,  1.02,  0.84,  0.11,  0.13,  0.08, -0.18, -0.06,
          0.38, 1.04,  0.55, -1.71,  0.24,  0.05,  0.49, -0.41,  0.70,  0.30,
          1.03,  0.14,  0.73,  0.56,  0.56,  0.98,  0.53,  0.27,  0.32,  0.95,
          0.10,  0.55,  1.18,  0.49,  0.58,  0.36,  0.18,  0.30,  1.71,  0.65,
          0.69,  0.68,  0.66,  1.24,  0.47 , 1.28,  0.60,  1.01,  0.76,  1.35,
          1.02,  0.75,  0.40,  0.37,  0.46,  0.47,  0.25,  0.61,  0.63,  0.86,
          0.92,  0.09,  1.66,  0.88,  0.68,  1.02,  1.17,  1.18,  1.71,  1.01,
          0.42,  0.56)


Mang=data.frame(Location,Treatment,Growth)

我想使用双向Anova来了解更改LocationTreatmentGrowth的影响。我想问两个问题:

(1)如果某些级别的预测变量无法通过正态性测试(如下所示),我还可以使用Anova吗?

> shapiro.test(subset(Mang,Location=="lcn")[,3])$p.value
[1] 0.01317841
> shapiro.test(subset(Mang,Treatment=="control")[,3])$p.value
[1] 0.008312405

(2)为什么在Anova中改变预测变量的顺序时结果会有所不同?

> test1=aov(Growth~Location+Treatment,data=Mang)
> summary(test1)
            Df Sum Sq Mean Sq F value  Pr(>F)   
Location     3  1.713  0.5710   2.708 0.05235 . 
Treatment    3  3.495  1.1650   5.524 0.00193 **
Residuals   65 13.707  0.2109                   
---
Signif. codes:  0 ?**?0.001 ?*?0.01 ??0.05 ??0.1 ??1


> test2=aov(Growth~Treatment+Location,data=Mang)
> summary(test2)
            Df Sum Sq Mean Sq F value   Pr(>F)    
Treatment    3  4.402  1.4673   6.958 0.000393 ***
Location     3  0.806  0.2687   1.274 0.290658    
Residuals   65 13.707  0.2109                     
---
Signif. codes:  0 ?**?0.001 ?*?0.01 ??0.05 ??0.1 ??1

0 个答案:

没有答案