[R-sig-ME] [SPAM] - Re: Bug in weights in lmer - Bayesian Filter detected spam
Martin Maechler
maechler at stat.math.ethz.ch
Wed Apr 23 21:50:54 CEST 2008
>>>>> "HaroldD" == Doran, Harold <HDoran at air.org>
>>>>> on Wed, 23 Apr 2008 13:22:45 -0400 writes:
HaroldD> No, I am not sure. Doug should clarify. I don't really understand the
HaroldD> difference between versions on R-forge and CRAN. I always download from
HaroldD> CRAN.
R-forge contains *development* versions of packages,
almost surely always more recent than CRAN versions.
For lme4, the situation is particular: The R-forge version has
had many updates, but never came with a guarantee of "uniformly
improved", and hence has not been CRAN-released for a while.
IIRC, I'd definitely use the R-forge version if I was interested in
generalized or non-linear or generalized non-linear
mixed effect model,
and I'd also use it if I wanted to be a nice person and help
Doug Bates to advance farther even faster .. ;-)
But then, I'd really install both versions (into *different* libraries!)
so I could chose which one to use for a given situation.
Martin
>> -----Original Message-----
>> From: Luca Borger [mailto:lborger at uoguelph.ca]
>> Sent: Wednesday, April 23, 2008 1:20 PM
>> To: Doran, Harold; Nick Isaac; R-sig-mixed-models at r-project.org
>> Subject: [SPAM] - Re: [R-sig-ME] Bug in weights in lmer -
>> Bayesian Filter detected spam
>>
>> Hi,
>>
>> are you sure? Unless I am misunderstanding something, I used
>> the latest lme4 development version available on R-forge:
>>
>> >[1] lme4_0.999375-13
>>
>> which I thought is newer then the CRAN version you used:
>>
>> > [1] lme4_0.99875-9
>>
>>
>> Please advice me if not.
>>
>> Cheers,
>>
>> Luca
>>
>>
>>
>> ----- Original Message -----
>> From: "Doran, Harold" <HDoran at air.org>
>> To: "Doran, Harold" <HDoran at air.org>; "Nick Isaac"
>> <njbisaac at googlemail.com>; <R-sig-mixed-models at r-project.org>
>> Sent: Wednesday, April 23, 2008 1:09 PM
>> Subject: Re: [R-sig-ME] Bug in weights in lmer
>>
>>
>> > It appears you and Luca have older versions. I'm using the
>> most recent
>> > version posted on CRAN. Try updating your packages and see
>> what happens.
>> >
>> >> sessionInfo()
>> > R version 2.6.2 (2008-02-08)
>> > i386-pc-mingw32
>> >
>> > locale:
>> > LC_COLLATE=English_United States.1252;LC_CTYPE=English_United
>> > States.1252;LC_MONETARY=English_United
>> > States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252
>> >
>> > attached base packages:
>> > [1] stats graphics grDevices utils datasets methods base
>> >
>> >
>> > other attached packages:
>> > [1] lme4_0.99875-9 Matrix_0.999375-7 lattice_0.17-4
>> >
>> > loaded via a namespace (and not attached):
>> > [1] grid_2.6.2
>> >
>> >> -----Original Message-----
>> >> From: Doran, Harold
>> >> Sent: Wednesday, April 23, 2008 10:16 AM
>> >> To: 'Nick Isaac'; 'R-sig-mixed-models at r-project.org'
>> >> Subject: RE: [R-sig-ME] Bug in weights in lmer
>> >>
>> >> I'm confused. When I run this, I get the exact same answers
>> >> for all three models for all variance components and for all
>> >> fixed effects. See my results below. Where is the bug?
>> >>
>> >> > w<-rep(1,nrow(sleepstudy))
>> >> > w
>> >> [1] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
>> >> 1 1 1 1 1 1 1 1 1 [38] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
>> >> 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 [75] 1 1 1 1 1 1 1 1 1 1
>> >> 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 [112] 1
>> >> 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
>> >> 1 1 1 1 1 [149] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
>> >> 1 1 1 1 1 1 1 1 1
>> >>
>> >> > (fm1 <- lmer(Reaction ~ Days + (Days|Subject), sleepstudy) )
>> >> Linear mixed-effects model fit by REML
>> >> Formula: Reaction ~ Days + (Days | Subject)
>> >> Data: sleepstudy
>> >> AIC BIC logLik MLdeviance REMLdeviance
>> >> 1754 1770 -871.8 1752 1744
>> >> Random effects:
>> >> Groups Name Variance Std.Dev. Corr
>> >> Subject (Intercept) 610.835 24.7151
>> >> Days 35.056 5.9208 0.067
>> >> Residual 655.066 25.5943
>> >> number of obs: 180, groups: Subject, 18
>> >>
>> >> Fixed effects:
>> >> Estimate Std. Error t value
>> >> (Intercept) 251.405 6.820 36.86
>> >> Days 10.467 1.546 6.77
>> >>
>> >> Correlation of Fixed Effects:
>> >> (Intr)
>> >> Days -0.137
>> >> > (fm2 <- lmer(Reaction ~ Days + (Days|Subject), sleepstudy,
>> >> weights =
>> >> > w) )
>> >> Linear mixed-effects model fit by REML
>> >> Formula: Reaction ~ Days + (Days | Subject)
>> >> Data: sleepstudy
>> >> AIC BIC logLik MLdeviance REMLdeviance
>> >> 1754 1770 -871.8 1752 1744
>> >> Random effects:
>> >> Groups Name Variance Std.Dev. Corr
>> >> Subject (Intercept) 610.835 24.7151
>> >> Days 35.056 5.9208 0.067
>> >> Residual 655.066 25.5943
>> >> number of obs: 180, groups: Subject, 18
>> >>
>> >> Fixed effects:
>> >> Estimate Std. Error t value
>> >> (Intercept) 251.405 6.820 36.86
>> >> Days 10.467 1.546 6.77
>> >>
>> >> Correlation of Fixed Effects:
>> >> (Intr)
>> >> Days -0.137
>> >> > (fm3 <- lmer(Reaction ~ Days + (Days|Subject), sleepstudy,
>> >> weights =
>> >> > w/sum(w)) )
>> >> Linear mixed-effects model fit by REML
>> >> Formula: Reaction ~ Days + (Days | Subject)
>> >> Data: sleepstudy
>> >> AIC BIC logLik MLdeviance REMLdeviance
>> >> 1754 1770 -871.8 1752 1744
>> >> Random effects:
>> >> Groups Name Variance Std.Dev. Corr
>> >> Subject (Intercept) 610.835 24.7151
>> >> Days 35.056 5.9208 0.067
>> >> Residual 655.066 25.5943
>> >> number of obs: 180, groups: Subject, 18
>> >>
>> >> Fixed effects:
>> >> Estimate Std. Error t value
>> >> (Intercept) 251.405 6.820 36.86
>> >> Days 10.467 1.546 6.77
>> >>
>> >> Correlation of Fixed Effects:
>> >> (Intr)
>> >> Days -0.137
>> >>
>> >> > -----Original Message-----
>> >> > From: r-sig-mixed-models-bounces at r-project.org
>> >> > [mailto:r-sig-mixed-models-bounces at r-project.org] On
>> Behalf Of Nick
>> >> > Isaac
>> >> > Sent: Wednesday, April 23, 2008 8:39 AM
>> >> > To: R-sig-mixed-models at r-project.org
>> >> > Subject: [R-sig-ME] Bug in weights in lmer
>> >> >
>> >> > I have unearthed a bug in the way lmer() deals with weights.
>> >> >
>> >> > Adding weights causes an inflation of the variance estimates.
>> >> > The phenomenon is easily demonstrated by comparing the following
>> >> > models, all of which should be identical:
>> >> >
>> >> > w<-rep(1,nrow(sleepstudy))
>> >> > (fm1 <- lmer(Reaction ~ Days + (Days|Subject), sleepstudy) )
>> >> > (fm2 <- lmer(Reaction ~ Days + (Days|Subject), sleepstudy,
>> >> weights =
>> >> > w) )
>> >> > (fm3 <- lmer(Reaction ~ Days + (Days|Subject), sleepstudy,
>> >> weights =
>> >> > w/sum(w)) )
>> >> >
>> >> > I have tried this with other datasets and models and
>> find the same
>> >> > general pattern. I find that the inflation factor is
>> correlated with
>> >> > sum(w) and is higher for cross-classified models than
>> simple nested
>> >> > ones.
>> >> >
>> >> > The fixed effect estimates are also changed.
>> >> >
>> >> > Best wishes, Nick
>> >> >
>> >> >
>> >> > > sessionInfo()
>> >> > R version 2.6.2 (2008-02-08)
>> >> > i386-apple-darwin8.10.1
>> >> >
>> >> > locale:
>> >> > en_GB.UTF-8/en_GB.UTF-8/en_GB.UTF-8/C/en_GB.UTF-8/en_GB.UTF-8
>> >> >
>> >> > attached base packages:
>> >> > [1] stats graphics grDevices utils datasets
>> methods base
>> >> >
>> >> > other attached packages:
>> >> > [1] lme4_0.999375-13 Matrix_0.999375-7 lattice_0.17-6
>> >> >
>> >> > loaded via a namespace (and not attached):
>> >> > [1] grid_2.6.2
>> >> >
>> >> > _______________________________________________
>> >> > R-sig-mixed-models at r-project.org mailing list
>> >> > https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>> >> >
>> >
>> > _______________________________________________
>> > R-sig-mixed-models at r-project.org mailing list
>> > https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>> >
>>
>>
HaroldD> _______________________________________________
HaroldD> R-sig-mixed-models at r-project.org mailing list
HaroldD> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
More information about the R-sig-mixed-models
mailing list