## response as a matrix
(m1 <- glmer(cbind(incidence, size - incidence) ~ period + (1 | herd),
cbpp, binomial, verbose = TRUE))
## response as a vector of probabilities and usage of argument "weights"
m2 <- glmer(incidence / size ~ period + (1 | herd), weights = size,
cbpp, binomial, verbose = TRUE)
## Confirm that these are equivalent:
stopifnot(all.equal(coef(m1), coef(m2)),
all.equal(ranef(m1), ranef(m2)))
Run the code above in your browser using DataLab