分裂图模型方差分析与 R

split plot model anova with R

我正在尝试用 R 解决一个练习,我在 农业和自然科学实验设计(第 164 页)一书中找到了这个练习

我已经把table传给了R软件

library(tibble)
tb = tibble("replica" = factor(x = rep(1:4,12), labels = c("I","II","III","IV")),
            "row" = factor(x = rep(1:4,c(12,12,12,12)), labels = c("12P","25P","12B","25B")),
            "hybrid" = factor(x = rep(1:2,c(24,24)), labels = c("P3730","B70XH55")),
            "density" = factor(x = c(rep(1:3,c(4,4,4)),rep(1:3,c(4,4,4)), rep(1:3,c(4,4,4)), rep(1:3,c(4,4,4))  ),
                         labels = c("12000","16000","20000")),
            "valor" = c(140,138,130,142,
                        145,146,150,147,
                        150,149,146,150,
                        136,132,134,138,
                        140,134,136,140,
                        145,138,138,142,
                        142,132,128,140,
                        146,136,140,141,
                        148,140,142,140,
                        132,130,136,134,
                        138,132,130,132,
                        140,134,130,136))

但是我创建aov模型有困难

model = aov(valor ~ replica + hybrid + replica/hybrid + row + replica/row + density + replica/density + row:density ,data = tb)

当应用 anova(model) 时,它给我的结果与下面的 table 不一致

如果有任何其他方法可以应用该模型,请耐心等待您的回答。我应用 anova() 的原因是 我可以提取 msres anova(model)['Residuals', 'Mean Sq'] 这有助于我计算 模型的可靠性 (cv)

我认为输出是使用agricolae库中的ssp.plot获得的,但首先你需要将行间距转换为连续变量:

tb$row = as.numeric(gsub("[A-Z]*","",as.character(tb$row)))

library(agricolae)

with(tb,ssp.plot(replica,hybrid,row,density,Y=valor))

ANALYSIS SPLIT-SPLIT PLOT:  valor 
Class level information

hybrid  :  P3730 B70XH55 
row     :  12 25 
density     :  12000 16000 20000 
replica     :  I II III IV 

Number of observations:  48 

Analysis of Variance Table

Response: valor
                   Df Sum Sq Mean Sq F value    Pr(>F)    
replica             3 237.73   79.24  7.0135 0.0719692 .  
hybrid              1 238.52  238.52 21.1106 0.0193734 *  
Ea                  3  33.90   11.30                      
row                 1 475.02  475.02 71.6262 0.0001487 ***
hybrid:row          1   1.69    1.69  0.2545 0.6319437    
Eb                  6  39.79    6.63                      
density             2 350.04  175.02 19.9233 7.959e-06 ***
density:hybrid      2  37.04   18.52  2.1083 0.1433767    
density:row         2  87.79   43.90  4.9968 0.0153376 *  
density:hybrid:row  2   1.63    0.81  0.0925 0.9119816    
Ec                 24 210.83    8.78                      
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

cv(a) = 2.4 %, cv(b) = 1.9 %, cv(c) = 2.1 %, Mean = 138.8542