[R-sig-ME] fixef and lme4

Douglas Bates bates at stat.wisc.edu
Tue Nov 25 19:53:44 CET 2008


On Tue, Nov 25, 2008 at 11:03 AM, Ben Zuckerberg <bz73 at cornell.edu> wrote:
> I can not seem to get the fixef function to work in lme4.  Any suggestions
> would be very welcome...
>
>>  data(sleepstudy)
>
>>  test<-lmer(Reaction ~ Days + (1|Subject) + (0+Days|Subject), sleepstudy)
>
>>  summary(test)
>
> Linear mixed model fit by REML
>
> Formula: Reaction ~ Days + (1 | Subject) + (0 + Days | Subject)
>
>  Data: sleepstudy
>
>  AIC  BIC logLik deviance REMLdev
>
> 1754 1770 -871.8     1752    1744
>
> Random effects:
>
> Groups   Name        Variance Std.Dev.
>
> Subject  (Intercept) 627.568  25.0513
>
> Subject  Days         35.858   5.9882
>
> Residual             653.584  25.5653
>
> Number of obs: 180, groups: Subject, 18
>
> Fixed effects:
>
>           Estimate Std. Error t value
>
> (Intercept)  251.405      6.885   36.51
>
> Days          10.467      1.559    6.71
>
> Correlation of Fixed Effects:
>
>    (Intr)
>
> Days -0.184
>
>>  fixef(test)
>
> Error in UseMethod("fixef") : no applicable method for "fixef

Felix is correct in his diagnosis that the problem originates with
having the nlme package loaded after lme4.  The clue is that the error
message states UseMethod which indicates S3 method dispatch.  The S4
method is still accessible but you need to call it as

lme4::fixef

The safest course is not to load the lme4 and nlme packages simultaneously.




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