[R-sig-ME] [lme4 package] Does the order of rows(trials) in a data frame (long format) affect the results of the lmer model (maybe somehow)?

Daniel Wright Daniel.Wright at act.org
Thu Jan 8 18:13:21 CET 2015

On floating points in R, an enjoyable discussion of this "Circle 1" of the inferno is in Patrick Burn's The R Inferno 


-----Original Message-----
From: R-sig-mixed-models [mailto:r-sig-mixed-models-bounces at r-project.org] On Behalf Of Emmanuel Curis
Sent: Thursday, January 08, 2015 11:00 AM
To: Ben Bolker
Cc: r-sig-mixed-models at r-project.org
Subject: Re: [R-sig-ME] [lme4 package] Does the order of rows(trials) in a data frame (long format) affect the results of the lmer model (maybe somehow)?


Does it really change the lineary algebra, or does it change its numerical implementation in computers? Since computer addition is not commutative, that would explain ordering effects...

> 1 + 1e-15 - 1
[1] 1.110223e-15
> 1 - 1 + 1e-15
[1] 1e-15

> version$version.string
version.string R version 3.0.1 (2013-05-16)

In other words, may be computation with such big matrice can lead to rounding errors that add-up quickly if matrices are somehow ill-conditionned?

I'm not familiar with this field, but for instance I noticed that when you try to compute linear model matrices, coefficients and so one using the projection formula, even with as few as a tenth of values, values that should be 0 in the projection matrices (and especially
inverses) are quickly around ~10^-16 and after that, things can get very bad quiclky, which is solved by adding a < cleaning > of matrices such as m[ abs( m ) < 1e^-10 ] <- 0...

Of course, the above approach is very very dirty and inefficient and has only pedagogical interest, but are the more subtle algorithm robust enough on that aspect for such big matrices?

On Wed, Jan 07, 2015 at 11:12:55PM -0500, Ben Bolker wrote:

<   We have seen one case where the order does change the results slightly
< (https://github.com/lme4/lme4/issues/262) , and have a < not-yet-reproducible report (see prev link) of a case where the order < changes the standard error estimates considerably more.  That the < order affects the results is surprising, but believable; I/we haven't < had a chance yet to dig through and figure out how the ordering could < change the linear algebra, but clearly it does.

                                Emmanuel CURIS
                                emmanuel.curis at parisdescartes.fr

Page WWW: http://emmanuel.curis.online.fr/index.html

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