em_converged function

Convergence Test for EM-Algorithm

Convergence Test for EM-Algorithm

em_converged(loglik, previous_loglik, tol = 1e-04, check.increased = FALSE)

Arguments

  • loglik: numeric. Current value of the log-likelihood function.
  • previous_loglik: numeric. Value of the log-likelihood function at the previous iteration.
  • tol: numerical. The tolerance of the test. If |LL(t) - LL(t-1)| / avg < tol, where avg = (|LL(t)| + |LL(t-1)|)/2, then algorithm has converged.
  • check.increased: logical. Check if likelihood has increased.

Returns

A logical statement indicating whether EM algorithm has converged. if check.increased = TRUE, a vector with 2 elements indicating the convergence status and whether the likelihood has decreased.

Examples

em_converged(1001, 1000) em_converged(10001, 10000) em_converged(10001, 10000, check = TRUE) em_converged(10000, 10001, check = TRUE)
  • Maintainer: Sebastian Krantz
  • License: GPL-3
  • Last published: 2024-06-09