R中的重复测量方差分析(分割图设计)

时间:2019-03-26 20:51:30

标签: r lm anova

我正尝试通过一项采用分割图设计的实验以及随着时间的推移采用的几种测量方法来拟合重复测量方差分析。

实验设计如下:

我在该字段中有 9个区块。在每个块中,我有两个表示分割因子的子图(命名为 trt ,“有”或“没有”特定处理)。在每个子图中(有或没有),我都有另一个具有两个四边形的分割因子(分别命名为 sp ,“物种1”,“物种2”)。在每个样方中,我在研究中每种物种都有两棵幼苗(每棵幼苗都有唯一的ID标识)。最终,我在实验中对每棵幼苗的给定响应变量进行了四个时间(周)重复测量。

因此,我有9个块,每个块内有2种处理,每个处理内有2种,每个种有2种幼苗。监测4周。

我想了解时间* trt * sp是否影响我的响应变量。

考虑到我的实验设计,以下代码是否正确地适用于aov重复测量拆分-分裂-绘图模型的误差项?

fit <- aov(response ~ time * sp * trt + Error(block/trt/sp/id), data = d3)
summary(fit)

Error: block
          Df Sum Sq Mean Sq F value Pr(>F)
Residuals  1  11.29   11.29               

Error: block:trt
    Df Sum Sq Mean Sq
trt  1  0.114   0.114

Error: block:trt:sp
       Df Sum Sq Mean Sq
sp      1  61.14   61.14
sp:trt  1  10.27   10.27

Error: block:trt:sp:id
          Df Sum Sq Mean Sq F value Pr(>F)
sp         1   7.16   7.159   2.299  0.141
trt        1   1.07   1.072   0.344  0.562
sp:trt     1   2.18   2.181   0.701  0.410
Residuals 28  87.17   3.113               

Error: Within
             Df Sum Sq Mean Sq F value Pr(>F)
time          1   0.38  0.3781   0.237  0.627
time:sp       1   0.93  0.9317   0.585  0.446
time:trt      1   1.91  1.9117   1.201  0.276
time:sp:trt   1   2.73  2.7257   1.712  0.194
Residuals   104 165.59  1.5922   

此代码会导致以下警告消息:

Warning message:
In aov(response ~ time * sp * trt + Error(block/trt/sp/id), data = d3) :
  Error() model is singular

我非常感谢您在此问题上的任何帮助。 非常感谢你!如果需要,我很乐意提供任何进一步的细节。

数据和图

说明结果 enter image description here

可重复性数据显示如下(打印输出):

编辑1(更新的数据集):

structure(list(block = c(1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 3L, 
3L, 3L, 3L, 4L, 4L, 4L, 4L, 5L, 5L, 5L, 5L, 6L, 6L, 6L, 6L, 7L, 
7L, 7L, 7L, 8L, 8L, 8L, 8L, 9L, 9L, 9L, 9L, 1L, 1L, 1L, 1L, 2L, 
2L, 2L, 2L, 3L, 3L, 3L, 3L, 4L, 4L, 4L, 4L, 5L, 5L, 5L, 5L, 6L, 
6L, 6L, 6L, 7L, 7L, 7L, 7L, 8L, 8L, 8L, 8L, 9L, 9L, 9L, 9L, 1L, 
1L, 1L, 1L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 4L, 4L, 4L, 4L, 5L, 
5L, 5L, 5L, 6L, 6L, 6L, 6L, 7L, 7L, 7L, 7L, 8L, 8L, 8L, 8L, 9L, 
9L, 9L, 9L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 4L, 
4L, 4L, 4L, 5L, 5L, 5L, 5L, 6L, 6L, 6L, 6L, 7L, 7L, 7L, 7L, 8L, 
8L, 8L, 8L, 9L, 9L, 9L, 9L), trt = c("without", "without", "with", 
"with", "with", "with", "without", "without", "with", "with", 
"without", "without", "with", "with", "without", "without", "with", 
"with", "without", "without", "with", "with", "without", "without", 
"without", "without", "with", "with", "with", "with", "without", 
"without", "without", "without", "with", "with", "without", "without", 
"with", "with", "with", "with", "without", "without", "with", 
"with", "without", "without", "with", "with", "without", "without", 
"with", "with", "without", "without", "with", "with", "without", 
"without", "without", "without", "with", "with", "with", "with", 
"without", "without", "without", "without", "with", "with", "without", 
"without", "with", "with", "with", "with", "without", "without", 
"with", "with", "without", "without", "with", "with", "without", 
"without", "with", "with", "without", "without", "with", "with", 
"without", "without", "without", "without", "with", "with", "with", 
"with", "without", "without", "without", "without", "with", "with", 
"without", "without", "with", "with", "with", "with", "without", 
"without", "with", "with", "without", "without", "with", "with", 
"without", "without", "with", "with", "without", "without", "with", 
"with", "without", "without", "without", "without", "with", "with", 
"with", "with", "without", "without", "without", "without", "with", 
"with"), sp = c("species 1", "species 2", "species 2", "species 1", 
"species 2", "species 1", "species 2", "species 1", "species 1", 
"species 2", "species 2", "species 1", "species 2", "species 1", 
"species 1", "species 2", "species 1", "species 2", "species 2", 
"species 1", "species 2", "species 1", "species 1", "species 2", 
"species 1", "species 2", "species 1", "species 2", "species 1", 
"species 2", "species 2", "species 1", "species 2", "species 1", 
"species 2", "species 1", "species 1", "species 2", "species 2", 
"species 1", "species 2", "species 1", "species 2", "species 1", 
"species 1", "species 2", "species 2", "species 1", "species 2", 
"species 1", "species 1", "species 2", "species 1", "species 2", 
"species 2", "species 1", "species 2", "species 1", "species 1", 
"species 2", "species 1", "species 2", "species 1", "species 2", 
"species 1", "species 2", "species 2", "species 1", "species 2", 
"species 1", "species 2", "species 1", "species 1", "species 2", 
"species 2", "species 1", "species 2", "species 1", "species 2", 
"species 1", "species 1", "species 2", "species 2", "species 1", 
"species 2", "species 1", "species 1", "species 2", "species 1", 
"species 2", "species 2", "species 1", "species 2", "species 1", 
"species 1", "species 2", "species 1", "species 2", "species 1", 
"species 2", "species 1", "species 2", "species 2", "species 1", 
"species 2", "species 1", "species 2", "species 1", "species 1", 
"species 2", "species 2", "species 1", "species 2", "species 1", 
"species 2", "species 1", "species 1", "species 2", "species 2", 
"species 1", "species 2", "species 1", "species 1", "species 2", 
"species 1", "species 2", "species 2", "species 1", "species 2", 
"species 1", "species 1", "species 2", "species 1", "species 2", 
"species 1", "species 2", "species 1", "species 2", "species 2", 
"species 1", "species 2", "species 1", "species 2", "species 1"
), id = structure(c(1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 
11L, 12L, 13L, 14L, 15L, 16L, 17L, 18L, 19L, 20L, 21L, 22L, 23L, 
24L, 25L, 26L, 27L, 28L, 29L, 30L, 31L, 32L, 33L, 34L, 35L, 36L, 
1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 13L, 14L, 
15L, 16L, 17L, 18L, 19L, 20L, 21L, 22L, 23L, 24L, 25L, 26L, 27L, 
28L, 29L, 30L, 31L, 32L, 33L, 34L, 35L, 36L, 1L, 2L, 3L, 4L, 
5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 13L, 14L, 15L, 16L, 17L, 18L, 
19L, 20L, 21L, 22L, 23L, 24L, 25L, 26L, 27L, 28L, 29L, 30L, 31L, 
32L, 33L, 34L, 35L, 36L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 
10L, 11L, 12L, 13L, 14L, 15L, 16L, 17L, 18L, 19L, 20L, 21L, 22L, 
23L, 24L, 25L, 26L, 27L, 28L, 29L, 30L, 31L, 32L, 33L, 34L, 35L, 
36L), .Label = c("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", "35", "36"), class = "factor"), time = c(1L, 
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 
2L, 2L, 2L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 
3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 
3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 4L, 4L, 4L, 4L, 4L, 
4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4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