TukeyHSD是否不适用于具有因子,整数和数字变量的ANCOVA?

时间:2018-12-20 15:14:22

标签: r

在r中运行ANCOVA。因为它具有一系列变量类型(阶乘,整数和数字),所以无法在数据集上成功执行TukeyHSD()。

我尝试将所有变量转换为因子,但还是没有运气。下面列出了数据集,然后是我的双向ANCOVA代码。我的目的是评估治疗的个体和综合效果(食物类型)和时间(从毛毛虫到a的时间,以天为单位),并按协变量初始重量(每个毛毛虫在体内的初始重量)分组。实验)。

> GM
      Trt     Larval.period   Initial.wt  Pupal.wt   Percent.weight.gain
1  Uninfested            14      0.181    0.294       62.43094
2  Uninfested            20      0.318    0.519       63.20755
3  Uninfested            18      0.218    0.527      141.74312
4  Uninfested            18      0.195    0.326       67.17949
5  Uninfested            26      0.250    0.511      104.40000
6  Uninfested            14      0.181    0.299       65.19337
7  Uninfested            22      0.213    0.584      174.17840
8  Uninfested            26      0.255    0.442       73.33333
9  Uninfested            20      0.236    0.481      103.81356
10 Uninfested            18      0.298    0.452       51.67785
11 Uninfested            18      0.295    0.418       41.69492
12 Uninfested            24      0.297    0.424       42.76094
13 Uninfested            20      0.342    0.481       40.64327
14 Uninfested            14      0.210    0.434      106.66667
15 Uninfested            22      0.212    0.352       66.03774
16 Uninfested            18      0.215    0.472      119.53488
17 Uninfested            14      0.227    0.380       67.40088
18 Uninfested            20      0.191    0.520      172.25131
19 Uninfested            26      0.175    0.668      281.71429
20 Uninfested            24      0.312    0.542       73.71795
21 Uninfested            14      0.215    0.391       81.86047
22   Infested            18      0.142    0.765      438.73239
23   Infested            18      0.347    0.844      143.22767
24   Infested            14      0.183    0.369      101.63934
25   Infested            16      0.207    0.384       85.50725
26   Infested            16      0.156    0.361      131.41026
27   Infested            16      0.181    0.340       87.84530
28   Infested            14      0.153    0.346      126.14379
29   Infested            26      0.135    0.632      368.14815
30   Infested            31      0.124    0.302      143.54839
31   Infested            18      0.166    0.337      103.01205
32   Infested            18      0.141    0.339      140.42553
33   Infested            18      0.125    0.355      184.00000
34   Infested            24      0.384    0.874      127.60417
35   Infested            18      0.129    0.262      103.10078
36   Infested            18      0.172    0.389      126.16279
37   Infested            24      0.115    0.488      324.34783
38   Infested            24      0.185    0.367       98.37838
39   Infested            26      0.128    0.463      261.71875
40   Infested            18      0.334    0.622       86.22754
41   Infested            16      0.204    0.345       69.11765
42   Infested            24      0.213    0.448      110.32864
43   Infested            26      0.207    0.934      351.20773
44   Infested            26      0.221    0.680      207.69231

ANCOVA  <-aov(Pupal.wt ~ Trt*Initial.wt*Larval.period, data = GM)

TukeyHSD(ANCOVA): Error in rep.int(n, length(means)) : unimplemented type 
'NULL' in 'rep3'
In addition: Warning messages:
1: In replications(paste("~", xx), data = mf) :
  non-factors ignored: Initial.wt
2: In replications(paste("~", xx), data = mf) :
  non-factors ignored: Larval.period
3: In replications(paste("~", xx), data = mf) :
  non-factors ignored: Trt, Initial.wt
4: In replications(paste("~", xx), data = mf) :
  non-factors ignored: Trt, Larval.period
5: In replications(paste("~", xx), data = mf) :
  non-factors ignored: Initial.wt, Larval.period
6: In replications(paste("~", xx), data = mf) :
  non-factors ignored: Trt, Initial.wt, Larval.period

数据集列在顶部。

0 个答案:

没有答案