[R-sig-ME] confint() and intervals() do not agree for lmList objects?
Ben Bolker
bbolker at gmail.com
Thu Jan 17 18:34:54 CET 2013
Bard, David E. (HSC <David-Bard at ...> writes:
> I've been an lme4 user for a while but recently tried to pick up
> nlme to gain more flexibility and wean myself off of other
> commercial competitors. As part of the transition, I've enjoyed
> reading through Pinheiro & Bates (2000) and digging out unknown (to
> me) pearls like lmList and nlsList objects. For better or for
> worse, I've been trying to run P&B models in both lme4 and nlme for
> comparison, and this has led to the quandary below:
> When plotting confidence intervals for lmList objects, I've noticed
> a transition among lme4 users from the older nlme intervals function
> to the newer lme4 confint method. Peculiarly, these two do not play
> nice with each other, and I'm having difficulty understanding why.
> Here is an example:
> > library(lme4)
> > library(nlme)
> > fm1 <- lme4:::lmList(Reaction ~ Days | Subject, sleepstudy)
> > ci1 <- confint(fm1,pool=T) #get low and high CI estimates and pooled sd
> > ci2 <- nlme:::intervals(fm1,pool=T)
##get low and high CI estimates, coef estimates and pooled sd
> > all.equal(unname(ci2[,c(1,3),1]),unname(ci1[,,1])) #compare intercept CIs
> [1] "Mean relative difference: 0.06869956"
> > all.equal(unname(ci2[,c(1,3),2]),unname(ci1[,,2])) #compare slope CIs
> [1] "Mean relative difference: 0.2868216"
> Even more strange, the boundaries from confint do not always
> encapsulate the actual lmList estimate.
> Perhaps I'm misunderstanding the pool option of confint?
>
> > apply(merge(ci1[,,1],ci2[,2,1],by=0),1,
> function(x) x[4] > x[2] && x[4] < x[3]) #intercept within
> confint bounds?
> [1] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
> [13] FALSE FALSE FALSE FALSE FALSE FALSE
> > apply(merge(ci1[,,2],ci2[,2,2],by=0),1,
> function(x) x[4] > x[2] && x[4] < x[3]) #slope within
> confint bounds?
> [1] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
> [13] FALSE FALSE FALSE FALSE FALSE FALSE
>
Thank you for the careful examples, and my apologies for this
short reply. I believe confint completely *ignores* the pool argument
at this point. I'm kind of surprised that `intervals` works at
all on `lmList` ... in general mixing nlme and lme4 has unpredictable
(=dangerous) results. I will have a deeper look at this shortly/when
I get a chance: I've added it to the issues list on github:
https://github.com/lme4/lme4/issues/26
thanks
Ben Bolker
More information about the R-sig-mixed-models
mailing list