rwinlib / gcc-4.9.3

Building R for Windows with the new gcc 4.9.3 toolchain
28 stars 7 forks source link

lme4 #10

Open jimhester opened 8 years ago

jimhester commented 8 years ago

This error occurs only with a 32 bit architecture, the full output from the test failure is

1. Failure (at test-nbinom_refit.R#18): glmer refit ----------------------------
m.base@beta not equal to (m.base.r <- refit(m.base))@beta
6/6 mismatches (average diff: 5.67e-06).
First 6:
 pos      x      y      diff
   1  1.631  1.631  4.46e-06
   2  0.767  0.767 -6.90e-06
   3  1.011  1.011 -6.07e-06
   4  1.512  1.512 -2.50e-06
   5 -0.615 -0.615  7.28e-06
   6 -0.610 -0.610  6.84e-06

It can be reproduced outside the tests with the following code

set.seed(101)
dd <- expand.grid(f1 = factor(1:3),
                  f2 = LETTERS[1:2], g=1:9, rep=1:15,
          KEEP.OUT.ATTRS=FALSE)
mu <- 5*(-4 + with(dd, as.integer(f1) + 4*as.numeric(f2)))
dd$y <- rnbinom(nrow(dd), mu = mu, size = 0.5)

m.base <- glmer(y ~ f1*f2 + (1|g), data=dd, family=poisson)
m.base.r <- refit(m.base)
all.equal(m.base@beta, m.base.r@beta)
#> [1] "Mean relative difference: 5.537048e-06"

It can be avoided by relaxing the numeric tolerance from .Machine$double.eps ^ 0.5

all.equal(m.base@beta, m.base.r@beta, tolerance = .Machine$double.eps ^ 0.33)
#> [1] TRUE

I am not sure of the exact cause, maybe changes in the V3 mingw runtime?