[R-sig-ME] Considerable discrepancies between fixed and random effect estimates of lme4 (glmer) and glmmADMB

Ben Bolker bbolker at gmail.com
Mon Feb 13 17:43:51 CET 2012


Adam Smith <raptorbio at ...> writes:

 
> I hope I'm not overlooking something elementary here, but estimated
> fixed and random effects are considerably different from the
> following Poisson model in lme4 and glmmADMB.  The fixed effects
> seem to differ most considerably...  Thanks for any thoughts...
> Adam Smith

> > sessionInfo()
> R version 2.14.1 (2011-12-22)
> Platform: x86_64-pc-mingw32/x64 (64-bit)
> 
> (SNIP)
> 
> other attached packages:
> [1] glmmADMB_0.7.2.5   lme4_0.999375-42   Matrix_1.0-3      
bbmle_1.0.4.1      numDeriv_2010.11-1
> [6] lattice_0.20-0     R2admb_0.7.5       MASS_7.3-16       

 
> > str(cons09) # The dataset
> 'data.frame':   394 obs. of  15 variables:
>  $ plot       : Factor w/ 16 levels "n_10","n_2","n_3",..: 
> 2 2 2 2 2 2 2 2 2 2 ...
>  $ plot_trt   : Factor w/ 32 levels 
> "cont_n_10","cont_n_2",..: 2 2 2 2 2 2 2 2 2 2 ...
>  $ geog       : Factor w/ 2 levels "n","s": 1 1 1 1 1 1 1 1 1 1 ...
>  $ trt        : Factor w/ 2 levels "cont","trt": 1 1 1 1 1 1 1 1 1 1 ...
>  $ count      : Factor w/ 14 levels "1","2","3","4",..:
>  1 2 3 4 5 6 7 8 9 10 ...
>  $ total      : int  341 326 257 244 185 141 128 121 115 84 ...
>  $ cons       : int  12 52 8 57 36 8 0 1 20 27 ...
>  $ dt         : int  4 3 3 3 3 3 3 3 3 3 ...
>  $ obs        : Factor w/ 394 levels "1","2","3","4",..: 
> 1 2 3 4 5 6 7 8 9 10 ...
>  $ logtotal   : num  5.83 5.79 5.55 5.5 5.22 ...
>  $ logdt      : num  1.39 1.1 1.1 1.1 1.1 ...

 
> # The models
> > Poiss <- glmmadmb(cons ~ count + geog + trt + count:trt + 
> count:geog + trt:geog + offset(logtotal) +
>         offset(logdt) + (1|plot) + (1|plot_trt),
>  zeroInflation=FALSE, family="poisson", data=cons09)
> 
> > P_glmer <- glmer(cons ~ count + geog + trt + 
> count:trt + count:geog + trt:geog + offset(log(total)) +
>       offset(log(dt)) + (1|plot) + 
> (1|plot_trt), family="poisson", data=cons09)
 
By the way, you can specify these fixed effects 
more compactly as (count+geog+trt)^2 ...

> > fixef(Poiss)

>   0.77333  0.58885  -0.21547 0.79101  0.24924  -0.02565  0.36004 
> -0.94852  0.39442  0.29032  0.13658 -0.39564 
>   -1.37470  -0.88496  -0.53259  -0.25434 
> -0.41033  1.18840  0.25678  0.69734 
> 0.59823  1.11430  -0.17330  -0.15364 
>   0.98442  0.51533  -0.99431 -1.63920  -0.40455  -1.55670  0.15891 
> 0.35378  0.45748  0.92293  0.78373 1.05440 
>   0.39598  0.32019  1.41600 
> 0.86656  2.45790  1.07350  -0.31149 

> # After detaching glmmADMB and lme4, then 
> re-requiring lme4 to avoid masking of lme4's fixef function
> > fixef(P_glmer)
>   -5.00326871  0.69554781  0.17105622  1.29467717 
> 0.97268949  0.87707266  1.39399967  0.22923370 
> 1.61829807  1.84546906  1.99506279  1.37859852 
>   0.53987085  1.13282524  -0.12901214  0.07021103 
> -0.52669841  0.87378323  0.05397134  0.46901053 
> 0.39863837  0.94486828  -0.18146287  -0.20340655 
>   0.77866847  0.49935778  -0.65101999  -1.05381279 
> -0.05290984  -1.54103716  -0.03887633  0.04570463  0.02076874 
> 0.47883964  0.23057821  0.49408747 
>   -0.15116087  -0.32683907  0.50098187  0.14670125 
> 1.63961096  0.40944384  -0.22555478 
> 
> I juxtapose ranef() estimates here for comparison's sake...
> 
  [snip]

  There's nothing obviously wrong here.  It's not a full solution,
but I wonder how wide the confidence intervals are ... if they
are very wide, then the practical answer is that these are poorly
determined estimates.  You're probably overfitting the model --
2 random effects plus 43 fixed-effect coefficients is
quite a lot for 394 observations (the general rule of thumb
is N/(# params)>10), especially if the Poisson data are sparse
(although they don't look that way from the first few
values listed in str() -- is there anyway you can allow
'count' to be continuous, or ordinal, rather than insisting
on it being categorical?) But it would be best to try to answer
more definitively ... can you send data?

  Ben Bolker




More information about the R-sig-mixed-models mailing list