[R-sig-ME] Interdependence of lme and lmer methods?

Douglas Bates bates at stat.wisc.edu
Thu Sep 27 16:13:29 CEST 2007


You are correct, the lme4 and nlme package mask methods from each
other.  It is not recommended that you have both of them attached in
the same session.

On 9/26/07, David Afshartous <dafshartous at med.miami.edu> wrote:
>
> All,
>
> Has anyone noticed interdependence of lmer and lmer methods, i.e., problems
> w/ methods when one is estimating models via both lme and lmer in the same
> session?  Example below. I searched the archives and didn't see anything.
>
>
> > sessionInfo()
> R version 2.5.1 (2007-06-27)
> i386-apple-darwin8.9.1
>
> locale:
> en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
>
> attached base packages:
> [1] "stats"     "graphics"  "grDevices" "utils"     "datasets"  "methods"
> "base"
>
> other attached packages:
>     nlme
> "3.1-84"
> > fm1 = lme(Thickness ~ 1, random = ~ 1 | Lot, Oxide)
> > ranef(fm1)
>   (Intercept)
> 1   -3.702524
> 2  -11.996179
> 3    0.928997
> 4   -4.779622
> 5   14.392722
> 6   20.747600
> 7   -8.764885
> 8   -6.826109
> ## ranef methol works fine.
> ## now load lme4 via menu far:
> Loading required package: Matrix
> Loading required package: lattice
> > ranef(fm1)
> Error in function (classes, fdef, mtable)  :
>     unable to find an inherited method for function "ranef", for signature
> "lme"
>
> ## ranef no longer works
> ## load nlme again via menu bar
>
> Attaching package: 'nlme'
>
>
>     The following object(s) are masked from package:lme4 :
>
>      BIC,
>      VarCorr,
>      fixef,
>      gsummary,
>      lmList,
>      pooledSD,
>      ranef
>
> > ranef(fm1)
>   (Intercept)
> 1   -3.702524
> 2  -11.996179
> 3    0.928997
> 4   -4.779622
> 5   14.392722
> 6   20.747600
> 7   -8.764885
> 8   -6.826109
>
> ## now it works fine
>
> In the other direction, similar problems for ranef on lmer models.
> for both directions, quick fix solution is to re-load the package for
> which the ranef statement applies
>
>
> Cheers,
> David
>
> _______________________________________________
> R-sig-mixed-models at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>




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