Running examples in ‘lme4-Ex.R’ failed
The error most likely occurred in:

> ### Name: glmer
> ### Title: Fitting Generalized Linear Mixed-Effects Models
> ### Aliases: glmer
> ### Keywords: models
> 
> ### ** Examples
> 
> ## generalized linear mixed model
> library(lattice)
> xyplot(incidence/size ~ period|herd, cbpp, type=c('g','p','l'),
+        layout=c(3,5), index.cond = function(x,y)max(y))
> (gm1 <- glmer(cbind(incidence, size - incidence) ~ period + (1 | herd),
+               data = cbpp, family = binomial))
Generalized linear mixed model fit by maximum likelihood (Laplace
  Approximation) [glmerMod]
 Family: binomial  ( logit )
Formula: cbind(incidence, size - incidence) ~ period + (1 | herd)
   Data: cbpp
      AIC       BIC    logLik -2*log(L)  df.resid 
 194.0531  204.1799  -92.0266  184.0531        51 
Random effects:
 Groups Name        Std.Dev.
 herd   (Intercept) 0.6421  
Number of obs: 56, groups:  herd, 15
Fixed Effects:
(Intercept)      period2      period3      period4  
    -1.3983      -0.9919      -1.1282      -1.5797  
> ## using nAGQ=0 only gets close to the optimum
> (gm1a <- glmer(cbind(incidence, size - incidence) ~ period + (1 | herd),
+                cbpp, binomial, nAGQ = 0))
Generalized linear mixed model fit by maximum likelihood (Adaptive
  Gauss-Hermite Quadrature, nAGQ = 0) [glmerMod]
 Family: binomial  ( logit )
Formula: cbind(incidence, size - incidence) ~ period + (1 | herd)
   Data: cbpp
      AIC       BIC    logLik -2*log(L)  df.resid 
 194.1087  204.2355  -92.0543  184.1087        51 
Random effects:
 Groups Name        Std.Dev.
 herd   (Intercept) 0.6418  
Number of obs: 56, groups:  herd, 15
Fixed Effects:
(Intercept)      period2      period3      period4  
    -1.3605      -0.9762      -1.1111      -1.5597  
> ## using  nAGQ = 9  provides a better evaluation of the deviance
> ## Currently the internal calculations use the sum of deviance residuals,
> ## which is not directly comparable with the nAGQ=0 or nAGQ=1 result.
> ## 'verbose = 1' monitors iteratin a bit; (verbose = 2 does more):
> (gm1a <- glmer(cbind(incidence, size - incidence) ~ period + (1 | herd),
+                cbpp, binomial, verbose = 1, nAGQ = 9))
start par. =  1 fn =  186.7231 
At return
eval:  18 fn:      184.10869 par: 0.641839
(NM) 20: f = 100.035 at   0.65834  -1.40366 -0.973379  -1.12553  -1.51926
(NM) 40: f = 100.012 at  0.650182  -1.39827 -0.993156  -1.11768  -1.57305
(NM) 60: f = 100.011 at  0.649102  -1.39735 -0.999034  -1.13415  -1.57634
(NM) 80: f = 100.01 at  0.647402  -1.39987 -0.987353  -1.12767  -1.57516
(NM) 100: f = 100.01 at   0.64823      -1.4 -0.991134  -1.12755  -1.58048
(NM) 120: f = 100.01 at  0.647543  -1.39916 -0.991869  -1.12839  -1.57993
(NM) 140: f = 100.01 at  0.647452  -1.39935 -0.991366  -1.12764  -1.57936
(NM) 160: f = 100.01 at  0.647519  -1.39925 -0.991348  -1.12784  -1.57948
(NM) 180: f = 100.01 at  0.647513  -1.39924 -0.991381  -1.12783  -1.57947
Generalized linear mixed model fit by maximum likelihood (Adaptive
  Gauss-Hermite Quadrature, nAGQ = 9) [glmerMod]
 Family: binomial  ( logit )
Formula: cbind(incidence, size - incidence) ~ period + (1 | herd)
   Data: cbpp
      AIC       BIC    logLik -2*log(L)  df.resid 
 110.0100  120.1368  -50.0050  100.0100        51 
Random effects:
 Groups Name        Std.Dev.
 herd   (Intercept) 0.6475  
Number of obs: 56, groups:  herd, 15
Fixed Effects:
(Intercept)      period2      period3      period4  
    -1.3992      -0.9914      -1.1278      -1.5795  
> 
> ## GLMM with individual-level variability (accounting for overdispersion)
> ## For this data set the model is the same as one allowing for a period:herd
> ## interaction, which the plot indicates could be needed.
> cbpp$obs <- 1:nrow(cbpp)
> (gm2 <- glmer(cbind(incidence, size - incidence) ~ period +
+     (1 | herd) +  (1|obs),
+               family = binomial, data = cbpp))
Error: Downdated VtV is not positive definite
Execution halted