[R] glht after lmer with "$S4class-" and "missing model.matrix-" errors with DATA

Anna Radtke annaradtke2309 at googlemail.com
Fri Jul 25 11:34:17 CEST 2008


maybe it's in the data? So here it comes.

> sv.growth
Grouped Data: length ~ meas | box_id
    meas spec    comp         water box_id   sprouts leaves    length
long.sprout
1      1   Sv control         moist      1  8.800000  37.80  211.2000
      60.6
2      1   Sv   xfull         moist      2  7.000000   8.00  174.8000
      62.8
3      1   Sv control         moist      3  9.000000  42.00  255.2000
      66.0
4      1   Sv    root         moist      4  7.800000  35.00  225.8000
      78.2
5      1   Sv    root         moist      5  7.800000  31.40  182.6000
      59.4
6      1   Sv   shoot         moist      6  8.800000  50.80  247.6000
      53.4
7      1   Sv    root         moist      7  7.000000  26.20  169.2000
      63.0
8      1   Sv   xfull         moist      8  4.600000   4.00   71.8000
      35.8
9      1   Sv    root         moist      9  8.800000  40.00  246.8000
      69.4
10     1   Sv   shoot         moist     10  8.000000  48.20  266.8000
      67.6
11     1   Sv control         moist     11 15.000000  71.80  380.2000
      53.6
12     1   Sv   shoot         moist     12 10.400000  41.20  271.8000
      58.6
13     1   Sv   shoot         moist     13  8.200000  44.00  243.8000
      53.4
14     1   Sv   xfull         moist     14  6.200000  10.00  171.6000
      67.2
15     1   Sv    root         moist     15  9.600000  42.20  187.6000
      57.8
16     1   Sv   xfull         moist     16  6.200000   7.80  164.0000
      63.6
17     1   Sv control         moist     17 11.000000  53.40  262.4000
      59.6
18     1   Sv control         moist     18  8.800000  45.00  245.4000
      63.8
19     1   Sv   xfull         moist     19  6.200000   7.40  161.0000
      61.6
20     1   Sv   shoot         moist     20  9.400000  38.40  209.0000
      74.8
21     1   Sv    root awater-logged     21  8.600000  42.00  252.0000
      75.2
22     1   Sv   shoot awater-logged     22  7.800000  34.80  238.8000
      80.8
23     1   Sv control awater-logged     23  9.750000  37.25  182.2500
      55.5
24     1   Sv control awater-logged     24  8.200000  51.00  287.2000
      77.8
25     1   Sv control awater-logged     25  8.500000  45.25  290.5000
      85.0
26     1   Sv   xfull awater-logged     26  8.800000  11.60  204.4000
      58.8
27     1   Sv   shoot awater-logged     27  6.600000  22.00  138.6000
      68.6
28     1   Sv   shoot awater-logged     28 10.400000  34.40  225.2000
      70.0
29     1   Sv    root awater-logged     29  5.000000  22.40  113.4000
      60.2
30     1   Sv control awater-logged     30  7.400000  38.00  220.4000
      73.8
31     1   Sv   xfull awater-logged     31  7.600000   5.00  143.8000
      54.8
32     1   Sv   xfull awater-logged     32  3.600000  10.20  124.6000
      74.2
33     1   Sv   xfull awater-logged     33  7.200000   6.00  162.6000
      60.8
34     1   Sv   shoot awater-logged     34  7.400000  26.40  210.4000
      86.2
35     1   Sv    root awater-logged     35  8.600000  34.80  257.6000
      81.6
36     1   Sv    root awater-logged     36  9.400000  31.00  196.2000
      70.4
37     1   Sv    root awater-logged     37  6.800000  34.20  204.4000
      85.4
38     1   Sv   xfull awater-logged     38  7.200000   6.60  151.6000
      66.0
39     1   Sv   shoot awater-logged     39  7.600000  39.60  227.4000
      63.8
40     1   Sv control awater-logged     40  8.400000  51.60  257.6000
      78.6
41     2   Sv control         moist      1  5.400000 100.80 1104.4000
     392.6
42     2   Sv   xfull         moist      2  5.200000  33.60  404.4000
     182.4
43     2   Sv control         moist      3  6.400000 108.60 1060.0000
     364.2
44     2   Sv    root         moist      4  5.000000  91.40 1017.6000
     394.4
45     2   Sv    root         moist      5  5.200000  78.40  772.4000
     312.4
46     2   Sv   shoot         moist      6  5.600000  77.60  775.6000
     318.0
47     2   Sv    root         moist      7  4.600000  73.20  730.2000
     314.4
48     2   Sv   xfull         moist      8  3.600000  17.40  238.8000
     136.6
49     2   Sv    root         moist      9  4.600000  94.20  980.4000
     366.8
50     2   Sv   shoot         moist     10  7.750000  96.50  876.2500
     327.0
51     2   Sv control         moist     11 10.000000 127.20 1209.6000
     327.2
52     2   Sv   shoot         moist     12  7.400000  83.40  818.6000
     314.0
53     2   Sv   shoot         moist     13  6.800000  83.80  812.4000
     283.6
54     2   Sv   xfull         moist     14  3.800000  29.80  325.0000
     183.4
55     2   Sv    root         moist     15  4.600000  72.20  734.8000
     378.0
56     2   Sv   xfull         moist     16  2.600000  24.40  282.0000
     189.0
57     2   Sv control         moist     17  8.000000 124.60 1246.8000
     371.4
58     2   Sv control         moist     18  4.400000  84.40 1061.4000
     377.2
59     2   Sv   xfull         moist     19  4.200000  29.00  353.8000
     193.4
60     2   Sv   shoot         moist     20  5.600000  74.40  743.2000
     378.8
61     2   Sv    root awater-logged     21  6.600000  93.60  912.4000
     351.6
62     2   Sv   shoot awater-logged     22  4.000000  62.00  714.8000
     401.0
63     2   Sv control awater-logged     23  5.000000  82.00  881.6000
     323.2
64     2   Sv control awater-logged     24  5.600000 110.80 1264.8000
     424.8
65     2   Sv control awater-logged     25  5.800000  89.60  930.8000
     346.2
66     2   Sv   xfull awater-logged     26  4.000000  39.60  455.2000
     268.8
67     2   Sv   shoot awater-logged     27  3.400000  55.40  614.6000
     384.2
68     2   Sv   shoot awater-logged     28  5.400000  71.00  698.0000
     320.6
69     2   Sv    root awater-logged     29  3.000000  66.40  757.4000
     427.8
70     2   Sv control awater-logged     30  4.800000  83.00  990.4000
     413.4
71     2   Sv   xfull awater-logged     31  3.200000  23.20  300.6000
     238.8
72     2   Sv   xfull awater-logged     32  1.400000  24.60  210.8000
     192.8
73     2   Sv   xfull awater-logged     33  3.200000  28.60  344.8000
     185.8
74     2   Sv   shoot awater-logged     34  3.600000  59.60  631.0000
     402.0
75     2   Sv    root awater-logged     35  5.200000  86.40  826.4000
     289.8
76     2   Sv    root awater-logged     36  7.200000  87.40  918.8000
     351.0
77     2   Sv    root awater-logged     37  4.200000  84.80  840.0000
     422.0
78     2   Sv   xfull awater-logged     38  2.400000  29.80  355.6000
     239.6
79     2   Sv   shoot awater-logged     39  6.200000  71.20  683.8000
     282.0
80     2   Sv control awater-logged     40  5.400000 106.40 1083.6000
     388.6
81     3   Sv control         moist      1  5.200000 149.60 1863.8000
     682.0
82     3   Sv   xfull         moist      2  2.500000  42.25  427.5000
     344.5
83     3   Sv control         moist      3  4.200000 134.00 1496.2000
     572.0
84     3   Sv    root         moist      4  3.600000 121.00 1488.8000
     706.8
85     3   Sv    root         moist      5  4.000000 115.00 1340.2000
     587.2
86     3   Sv   shoot         moist      6  2.600000  80.00  976.0000
     613.2
87     3   Sv    root         moist      7  3.600000  94.40 1187.2000
     555.0
88     3   Sv   xfull         moist      8  3.500000  41.75  367.0000
     195.5
89     3   Sv    root         moist      9  3.600000 120.20 1450.4000
     630.6
90     3   Sv   shoot         moist     10  2.600000  85.00 1007.2000
     586.0
91     3   Sv control         moist     11  4.000000 118.80 1386.0000
     626.6
92     3   Sv   shoot         moist     12  2.200000  72.40  942.6000
     578.4
93     3   Sv   shoot         moist     13  2.200000  80.60  957.6000
     606.0
94     3   Sv   xfull         moist     14  1.250000  27.00  308.0000
     297.0
95     3   Sv    root         moist     15  2.600000  85.80 1080.2000
     676.8
96     3   Sv   xfull         moist     16  1.666667  41.00  475.6667
     374.0
97     3   Sv control         moist     17  4.400000 148.00 1795.6000
     681.8
98     3   Sv control         moist     18  3.400000 107.80 1484.4000
     653.6
99     3   Sv   xfull         moist     19  2.400000  49.80  450.6000
     326.2
100    3   Sv   shoot         moist     20  2.800000  73.60  896.2000
     663.8
101    3   Sv    root awater-logged     21  4.800000 119.00 1431.6000
     585.0
102    3   Sv   shoot awater-logged     22  1.800000  61.20  896.8000
     654.0
103    3   Sv control awater-logged     23  4.600000 123.80 1471.6000
     552.0
104    3   Sv control awater-logged     24  5.000000 144.00 1906.6000
     734.2
105    3   Sv control awater-logged     25  3.400000 107.80 1388.4000
     639.0
106    3   Sv   xfull awater-logged     26  1.800000  53.20  586.8000
     439.4
107    3   Sv   shoot awater-logged     27  1.800000  68.40  910.6000
     704.4
108    3   Sv   shoot awater-logged     28  3.400000  88.20 1092.0000
     615.0
109    3   Sv    root awater-logged     29  2.800000 101.20 1342.8000
     740.4
110    3   Sv control awater-logged     30  4.000000 125.40 1556.6000
     769.6
111    3   Sv   xfull awater-logged     31  2.000000  52.20  534.8000
     451.0
112    3   Sv   xfull awater-logged     32  1.800000  40.40  428.6000
     375.6
113    3   Sv   xfull awater-logged     33  2.000000  41.20  420.6000
     295.6
114    3   Sv   shoot awater-logged     34  1.800000  74.60  978.8000
     760.6
115    3   Sv    root awater-logged     35  4.000000 110.80 1262.8000
     494.4
116    3   Sv    root awater-logged     36  6.400000 129.20 1518.8000
     590.4
117    3   Sv    root awater-logged     37  4.600000 124.60 1389.8000
     746.0
118    3   Sv   xfull awater-logged     38  2.000000  39.00  472.6000
     398.4
119    3   Sv   shoot awater-logged     39  1.600000  59.80  809.4000
     576.4
120    3   Sv control awater-logged     40  4.400000 134.60 1622.6000
     664.4
2008/7/25 Anna Radtke <annaradtke2309 at googlemail.com>:
>> Hello everybody.
> In my case, calculating multiple comparisons (Tukey) after lmer
> produced the following two errors:
>
> > sv.mc <- glht(model.sv,linfct=mcp(comp="Tukey"))
> Error in x$terms : $ operator not defined for this S4 class
> Error in factor_contrasts(model) :
>  no 'model.matrix' method for 'model' found!
>
> What I have done before:
>
> > sv.growth <- groupedData(length~meas|box_id,outer=~comp,data=sv.growth)
> > model.sv <- lmer(length~comp+(meas|box_id),data=sv.growth)
> Warning message:
> In .local(x, ..., value) :
>  Estimated variance-covariance for factor 'box_id' is singular
> > summary(model.sv)
> Linear mixed-effects model fit by REML
> Formula: length ~ comp + (meas | box_id)
>   Data: sv.growth
>  AIC  BIC logLik MLdeviance REMLdeviance
>  1587 1606 -786.4       1605         1573
> Random effects:
>  Groups   Name        Variance Std.Dev. Corr
>  box_id   (Intercept) 466698.1 683.153
>          meas        230733.7 480.347  -1.000
>  Residual               9138.3  95.595
> number of obs: 120, groups: box_id, 40
> Fixed effects:
>            Estimate Std. Error t value
> (Intercept)   600.90      21.31  28.196
> comproot     -124.84      30.14  -4.142
> compshoot    -167.36      30.14  -5.553
> compxfull    -375.13      30.14 -12.446
> Correlation of Fixed Effects:
>          (Intr) comprt cmpsht
> comproot  -0.707
> compshoot -0.707  0.500
> compxfull -0.707  0.500  0.500
>
> Thanks for youR help in advance.
> Anna



--
Anna Radtke
Hopfengarten 21
35043 Marburg
Tel.: 0162-8211685



More information about the R-help mailing list