[R] Problem with lmer and fixef

Ben Bolker bbolker at gmail.com
Thu Apr 12 16:23:15 CEST 2012


swertie <v_coudrain <at> voila.fr> writes:

> I am trying to do contrasts after applying a binomial mixed effect model
> with the function lmer. I have to extract the fix effect values, but as I
> write fixef(model), I get this error message:  
> 
> Error in UseMethod("fixef") : 
> no method for 'fixef' with objects of class "mer" 
> 
> Has anybody some ideas why? And how can I then post-hoc testing my data if I
> cannot do the contrasts?
> 
> Thank you very much

  The most likely answer is that you have loaded another package that
interferes with the lme4 package, most likely nlme.  For example:

library(lme4) ## CRAN version, or use lme4.0 from r-forge
example(lmer)  ## to generate some fitted values
fixef(fm1) ## works
library(nlme) ## produces warning about masking "The following objects ..."
fixef(fm1) ## gives your error
detach("package:nlme") 
fixef(fm1)  ## works again

  other possible culprits are the glmmADMB package, or other
packages that depend on (and hence automatically load) nlme.
See sessionInfo() ...

  Questions like this are probably more suited to the r-sig-mixed-models
list.

  Ben Bolker



More information about the R-help mailing list