[R] lme4 package: Fitted values and residuals

Renaud Lancelot renaud.lancelot at gmail.com
Sat Nov 18 05:35:25 CET 2006


Not quite:

> library(lme4)
> sessionInfo()
R version 2.4.0 (2006-10-03)
i386-pc-mingw32

locale:
LC_COLLATE=French_France.1252;LC_CTYPE=French_France.1252;LC_MONETARY=French_France.1252;LC_NUMERIC=C;LC_TIME=French_France.1252

attached base packages:
[1] "methods"   "stats"     "graphics"  "grDevices" "utils"
"datasets"  "tcltk"     "base"

other attached packages:
      lme4     Matrix    lattice   fortunes       svIO     R2HTML
svMisc   svSocket      svIDE
"0.9975-9" "0.9975-6"  "0.14-13"    "1.3-2"    "0.9-5"     "1.58"
"0.9-5"    "0.9-5"    "0.9-5"
> example(cbpp)

cbpp> (m1 <- lmer(cbind(incidence, size - incidence) ~ period +
    (1 | herd), family = binomial, data = cbpp))
[snip]
> head(fitted(m1))
[1] -0.803955 -1.807372 -1.945307 -2.388617 -1.692780 -2.696197
> head(resid(m1))
Erreur : 'resid' n'est pas encore implémenté
[snip]

Best,

Renaud




2006/11/18, Joel Dubin <jdubin at uwaterloo.ca>:
> Thank you, Martin, for pointing this out (not to mention the missing
> sessionInfo() piece).  Indeed the resid() call works as expected with
> the most recent update of lme4.
>
> Cheers, Joel.
>
>
> Martin Maechler wrote:
> >>>>>> "Joel" == Joel Dubin <jdubin at uwaterloo.ca>
> >>>>>>     on Fri, 17 Nov 2006 16:19:16 -0500 writes:
> >>>>>>
> >
> >     Joel> Hello, Indeed, implementing the fitted and resid calls
> >     Joel> on the fm1 object from example(lmer), the fitted
> >     Joel> function worked, but the resid did not:
> >
> >     >> resid(fm1)
> >     Joel> Error in resid(fm1) : no slot of name "family" for
> >     Joel> this object of class "lmer"
> >
> >     Joel> I am using R 2.4.0 (on Windows XP), with the update of
> >     Joel> lme4 (lmer within) written for 2.4.0.
> >
> > I think you should update lme4 [ update.packages(.....) ],
> > since the above looks suspiciously like a bug that had been
> > fixed not so long ago.
> >
> > IIRC, the posting guide asks you to provide  sessionInfo()
> > in such situations.
> >
> > Regards,
> > Martin
> >
>


-- 
Renaud LANCELOT
Département Elevage et Médecine Vétérinaire (EMVT) du CIRAD
Directeur adjoint chargé des affaires scientifiques

CIRAD, Animal Production and Veterinary Medicine Department
Deputy director for scientific affairs

Campus international de Baillarguet
TA 30 / B (Bât. B, Bur. 214)
34398 Montpellier Cedex 5 - France
Tél   +33 (0)4 67 59 37 17
Secr. +33 (0)4 67 59 39 04
Fax   +33 (0)4 67 59 37 95



More information about the R-help mailing list