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

Anna Radtke annaradtke2309 at googlemail.com
Fri Jul 25 11:27:20 CEST 2008


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



More information about the R-help mailing list