Skip to main content
2 of 2
added 1 character in body
Dimitris Rizopoulos
  • 21.5k
  • 2
  • 25
  • 51

Function glmer() uses by default the Laplace approximation, which is not optimal for dichotomous data. A better alternative is the adaptive Gaussian quadrature. You can use this method by setting argument nAGQ of glmer() to a higher number (e.g., 11 or 15) or alternatively using the GLMMadaptive package. In your example, it gives:

library("GLMMadaptive")
helpmeobiwan <- list(NestPlot = c(1, 0, 0, 0, 0 ,0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,0, 0, 0, 0, 0, 0, 0, 0, 0),NumDeadJun = c( 0.1409216, -0.1932639,-0.5274494,-0.5274494, 0.1409216, -0.5274494, -0.5274494 , 0.4751071, -0.5274494 , 2.1460347 ,-0.5274494, -0.1932639, 0.8092926, -0.5274494, -0.5274494 ,-0.5274494 ,-0.1932639, 0.1409216, -0.5274494, -0.5274494 ,-0.5274494, -0.5274494 ,-0.5274494,  0.1409216,-0.5274494, -0.5274494 ,-0.5274494,  0.1409216, -0.5274494,  0.1409216, -0.5274494, -0.5274494, -0.5274494, -0.1932639, -0.1932639, -0.5274494,  0.4751071 , 0.1409216 ,-0.5274494, -0.5274494, -0.5274494, -0.5274494, -0.5274494, -0.5274494, -0.5274494, -0.5274494, -0.1932639, -0.5274494, -0.5274494 ,-0.5274494 ,-0.5274494,  0.1409216, -0.5274494, -0.5274494, -0.1932639, -0.5274494, -0.5274494, -0.5274494,  0.1409216, -0.5274494, -0.5274494  ,3.1485912 , 2.4802202,  1.4776637, -0.5274494 , 2.8144057, -0.5274494, -0.5274494,  1.1434781,  3.8169623,  3.8169623 ,-0.1932639, -0.5274494  ,1.4776637 , 1.8118492, -0.5274494),RandomPair = c(  "Madera2" ,  "Starfire1", "Madera2" ,  "Madera3" ,  "Starfire1" ,"Starfire1", "Starfire2", "Madera1" , "Madera3"   ,"Starfire2" ,"Starfire2", "Madera1",   "Madera2",  "Starfire1", "Starfire1" ,"Starfire1", "Madera1",   "Madera2" ,  "Starfire1", "Starfire1", "Starfire1", "Madera1" ,  "Starfire1", "Starfire1", "Madera1",   "Madera1" , "Starfire1", "Madera2" ,  "Madera1",   "Madera2" ,  "Madera1" ,  "Madera1"  , "Starfire1" ,"Starfire1", "Starfire1" ,"Starfire1" ,"Madera2"  , "Madera2",   "Starfire2" ,"Starfire2", "Starfire2" ,"Madera3" ,  "Madera3" ,  "Madera3" ,  "Madera3" ,  "Madera3" ,  "Starfire2", "Starfire2", "Starfire2", "Starfire2" ,"Starfire2", "Madera3",  "Madera3" ,  "Starfire2", "Madera3" ,  "Madera1"  , "Starfire2" ,"Starfire1", "Madera2" ,  "Madera3" ,  "Madera3"  , "Madera2"  , "Madera3"   ,"Starfire2", "Madera3",   "Starfire1", "Madera3"  , "Starfire2", "Starfire1", "Madera3",   "Starfire1", "Starfire2" ,"Madera1" ,  "Starfire2", "Starfire2", "Madera1"  ))
helpmeobiwan <- as.data.frame(helpmeobiwan)

fm <- mixed_model(NestPlot ~ NumDeadJun, random = ~ 1 | RandomPair, 
                  family = binomial(), data = helpmeobiwan)

summary(fm)
#> 
#> Call:
#> mixed_model(fixed = NestPlot ~ NumDeadJun, random = ~1 | RandomPair, 
#>     data = helpmeobiwan, family = binomial())
#> 
#> Data Descriptives:
#> Number of Observations: 76
#> Number of Groups: 5 
#> 
#> Model:
#>  family: binomial
#>  link: logit 
#> 
#> Fit statistics:
#>   log.Lik      AIC      BIC
#>  -46.2248 98.44959 97.27791
#> 
#> Random effects covariance matrix:
#>                StdDev
#> (Intercept) 0.0477673
#> 
#> Fixed effects:
#>             Estimate Std.Err z-value  p-value
#> (Intercept)  -0.1568  0.2829 -0.5544 0.579304
#> NumDeadJun   -1.2274  0.4917 -2.4961 0.012558
#> 
#> Integration:
#> method: adaptive Gauss-Hermite quadrature rule
#> quadrature points: 11
#> 
#> Optimization:
#> method: hybrid EM and quasi-Newton
#> converged: TRUE
Dimitris Rizopoulos
  • 21.5k
  • 2
  • 25
  • 51