Skip to content
Prev 13466 / 20628 Next

discrepancies in lme4

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 15-06-17 12:00 PM, Julia Hoffmann wrote:
Without looking at the data, I'm not sure -- I only have one guess.
For large data sets (number of obs > 10^4) we have noticed that the
relatively crude finite-difference calculation we do to estimate the
variance-covariance matrix/standard errors is sometimes unreliable.

Here's a comparison of three methods of computing standard errors;
(1) using numDeriv::hessian (the most accurate general method we
currently have available); (2) using an internal finite-difference
calculation; (3) using internal stored information (the old method).

  In these cases the answers are quite similar (within a few percent),
but maybe they diverge in your case ...


library(lme4)
gm1 <- glmer(cbind(incidence, size - incidence) ~ period + (1 | herd),
              data = cbpp, family = binomial)
library(numDeriv)
dd <- update(gm1,devFunOnly=TRUE)
pp <- unlist(getME(gm1,c("theta","beta")))
H <- hessian(dd,pp)
all.equal(H,H0 <- gm1 at optinfo$derivs$Hessian)
sqrt(diag(solve(H/2))[-1])  ## use numDeriv::hessian
sqrt(diag(vcov(gm1)))       ## use internal finite-diff calc
## based on internal (obsolete) stored information
sqrt(diag(vcov(gm1,use.hessian=FALSE)))
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)

iQEcBAEBAgAGBQJVguLHAAoJEOCV5YRblxUHxjwIAMY5bnDvAXTSeVAKPxezvmpT
96L31nxhxePuDJsDj/JXxbCQfj+itU2dclY9WA6jWqzo42rXnQX+Ek64Oyu+ursi
eqkXWHtVJ6Fn54BKYT8czeVP+NripsFBy2VVf1awEZnsSbKGMXsu/vSwSNcykOKY
w+oG0reOsQxYk+F0i6vio755kaYNLo519m9ciIU6uv5IqncYyQvFFdpaCgPUF1yV
IeQveVx1O23EZGJ3aRD+UzaaDsr1mK0YHxycm4hW0j+DYI06pbDyw06h96oM4dE0
PGXzGMzGMWhnMeQvvd883AUub63ksh8tMgWq66vmtWK3vCGHMW9BYmzQ7nT1si8=
=boUJ
-----END PGP SIGNATURE-----