|||
程序代码如下:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | ######### 代码清单 ######### #### 建立数据集df #### yield <- scan() 24 30 28 26 27 24 21 26 31 28 25 30 32 33 33 28 21 22 16 21 Treat <- rep( paste("A", 1:5, sep = ""), rep(4, 5) ) df <- data.frame( Treat, yield) ######## 方差分析 ##### fit <- aov(yield ~ Treat, data = df) summary(fit) |
运行结果如下:
1 2 3 4 5 6 | > summary(fit) Df Sum Sq Mean Sq F value Pr(>F) Treat 4 301.2 75.30 11.18 0.000209 *** Residuals 15 101.0 6.73 --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 |
当F检验显著或极显著时,就有必要进行处理平均数两两之间的比较,以判断不同处理平均数之间的差异显著性。这种多个平均数两两间的相互比较称为多重比较(multiple comparison)。
运行结果如下:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | ##### 多重比较之ducan 方法 #### library( agricolae ) duncan.test( fit, "Treat", alpha = 0.05 ) ##### 运行结果 ##### > duncan.test( fit, "Treat", alpha = 0.05 ) Study: Duncan's new multiple range test for yield Mean Square Error: 6.733333 Treat, means yield std.err replication A1 27.0 1.290994 4 A2 24.5 1.322876 4 A3 28.5 1.322876 4 A4 31.5 1.190238 4 A5 20.0 1.354006 4 alpha: 0.05 ; Df Error: 15 Critical Range 2 3 4 5 3.910886 4.099664 4.216980 4.296902 Means with the same letter are not significantly different. Groups, Treatments and means a A4 31.5 ab A3 28.5 b A1 27 b A2 24.5 c A5 20 |
由结果可知,A4显著高于A1、A2和A5,但与A3之间无显著差异。
Archiver|手机版|科学网 ( 京ICP备07017567号-12 )
GMT+8, 2024-9-1 18:13
Powered by ScienceNet.cn
Copyright © 2007- 中国科学报社