check_convergence() provides an alternative convergence test for merMod-objects.

check_convergence(x, tolerance = 0.001, ...)

## Arguments

x A merMod-object. Indicates up to which value the convergence result is accepted. The smaller tolerance is, the stricter the test will be. Currently not used.

## Value

TRUE if convergence is fine and FALSE if convergence is suspicious. Additionally, the convergence value is returned as attribute.

## Details

check_convergence() provides an alternative convergence test for merMod-objects, as discussed here and suggested by Ben Bolker in this comment. Further details can be found in convergence.

## Examples

library(lme4)#> Loading required package: Matrixdata(cbpp)
set.seed(1)
cbpp$x <- rnorm(nrow(cbpp)) cbpp$x2 <- runif(nrow(cbpp))

model <- glmer(
cbind(incidence, size - incidence) ~ period + x + x2 + (1 + x | herd),
data = cbpp,
family = binomial()
)#> Warning: Model failed to converge with max|grad| = 0.00114582 (tol = 0.001, component 1)
check_convergence(model)#> [1] TRUE
#> [1] 0.0002803075