Skip to content
Prev 189 / 20628 Next

Poor convergence when using binomial response

Hi,

I'm seeing poor convergence of a model using the binomial family. In one 
case, I have a binomial response for which I use the 'weights' argument. 
In a second case, I expand the binomial response to Bernoulli trials and 
refit. Theoretically, they should be the same model. However, that does 
not appear to be the case because the residual scale for the binomial 
case is unbelievably large. Could someone (Prof. Bates) please help 
diagnose this problem?

And thank you so much for such wonderful software. I truly appreciate 
the effort.

Thanks,

--sundar

tmp <- read.csv(url("http://sdorairaj.googlepages.com/tmp.csv"))
tmp[2:4] <- lapply(tmp[2:4], factor)
library(lme4)
fit <- lmer(1 - y ~ z + (1 | A) + (1 | A:B), tmp,
             binomial("cloglog"), weights = as.numeric(w))
## see below for expand.bin
tmp2 <- expand.bin(tmp, "x", "w")
fit2 <- lmer(x ~ z + (1 | A) + (1 | A:B), tmp2, binomial("cloglog"))

fit3 <- glm(1 - y ~ z, binomial("cloglog"), tmp, w)
fit4 <- glm(x ~ z, binomial("cloglog"), tmp2)

cbind(sapply(list(fit, fit2), fixef),
       sapply(list(fit3, fit4), coef))
#                  [,1]       [,2]       [,3]       [,4]
#(Intercept) -2.8227711 -3.1247457 -2.8227711 -2.8227711
#z2          -0.2680992 -0.2694113 -0.2680992 -0.2680992
#z3           0.3109447  0.3233432  0.3109447  0.3109447


expand.bin <- function (data, x, n) {
   char.x <- x
   char.n <- n
   x <- data[[x]]
   n <- data[[n]]
   i <- rep(seq(nrow(data)), n)
   data <- data[i, , drop = FALSE]
   expand <- function(z) c(rep(0, diff(z)), rep(1, z[1]))
   x <- apply(cbind(x, n), 1, expand)
   data[[char.x]] <- if(is.matrix(x)) c(x) else unlist(x)
   row.names(data) <- seq(nrow(data))
   data
}

 > sessionInfo()
R version 2.5.0 (2007-04-23)
i386-pc-mingw32

locale:
LC_COLLATE=English_United States.1252;LC_CTYPE=English_United 
States.1252;LC_MONETARY=English_United 
States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252

attached base packages:
[1] "stats"     "graphics"  "grDevices" "utils"     "datasets"  "methods"
[7] "base"

other attached packages:
        lme4      Matrix     lattice
"0.99875-0" "0.99875-1"    "0.15-6"