[R-sig-ME] inconsistent results between lme4 and lme4.0

Ben Bolker bbolker at gmail.com
Fri Aug 9 05:04:00 CEST 2013


Kevin Wright <kw.stat at ...> writes:

> 
> I had an example with noticeable differences as well.  For me, using
> optimizer="bobyqa" seemed to work better.
> 
> Kevin

  I did try this with bobyqa and got better answers:

sim <- function(N, n) { c.mer(lmer(y ~ x1 + x2 + (1 | grp), dgp())) }
sim2 <- function(N, n) { c.mer(lmer(y ~ x1 + x2 + (1 | grp), dgp(),
                         control=lmerControl(optimizer="bobyqa"))) }

set.seed(080813)
apply(sapply(1:nsims, sim), 1, function(xx) c(mean(xx),sd(xx)))
# the means, in row 1, should be 1s across the board... but aren't
##     (Intercept)          x1       x2 grp.(Intercept)
## [1,]    1.418810 -0.02859056 0.143737        1.151423 2.0353251
## [2,]    1.474223  0.28381662 2.815086        1.138676 0.6091787

set.seed(080813)
apply(sapply(1:nsims, sim2), 1, function(xx) c(mean(xx),sd(xx)))
##      (Intercept)        x1       x2 grp.(Intercept)          
## [1,]   0.9694322 1.0135719 1.168296       1.0372534 1.0239419
## [2,]   1.2322048 0.1949554 2.157951       0.9658897 0.2899341

detach(package:lme4)
library(lme4.0) # lme4.0_0.9999-1

apply(sapply(1:nsims, sim), 1, function(xx) c(mean(xx),sd(xx)))
##      (Intercept)        x1       x2 grp.(Intercept)          
## [1,]    1.055962 1.0008875 1.050862        1.124547 1.0029512
## [2,]    1.335184 0.2055197 2.288807        1.155740 0.2802394

   We will try to look into this.  It's rather difficult to come
up with numerical methods that are uniformly better (although we
were hoping ...) -- we have also certainly seen a number of cases
where lme4 does much better than lme4.0 ...  ideally we can at
least find numeric summaries that will warn of dangerous situations.

  cheers
    Ben Bolker


> 
> On Thu, Aug 8, 2013 at 4:52 PM, Malcolm Fairbrother <
> M.Fairbrother at ...> wrote:
> 
> > Dear list,
> >
> > My understanding is that a 1.0 version of lme4 is coming out soon, but
> > currently I'm getting some disconcerting results from a simple 
> simulation.
> > lme4.0, in contrast, generates sensible results. I was investigating the
> > properties of mixed models fitted to very small numbers of 
> level-2 units,
> > and got the results below. Maybe there's some reason for this, 
> but I'd be
> > interested to hear... Or alternatively, I thought people might be
> > interested to know.
> >
> > Cheers,
> > Malcolm
> >
> >



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