From eb8d4a14111c78cda82b016c9a0489d810d1af50 Mon Sep 17 00:00:00 2001 From: Elliot Gould Date: Mon, 11 Sep 2023 04:28:24 +1000 Subject: [PATCH] Add check_convergence method for parsnip _glm model (#605) Co-authored-by: Daniel --- NAMESPACE | 1 + R/check_convergence.R | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/NAMESPACE b/NAMESPACE index 3479f911a..b5c3ee92b 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -45,6 +45,7 @@ S3method(check_collinearity,probitmfx) S3method(check_collinearity,zerocount) S3method(check_collinearity,zeroinfl) S3method(check_concurvity,gam) +S3method(check_convergence,"_glm") S3method(check_convergence,default) S3method(check_convergence,glmmTMB) S3method(check_convergence,merMod) diff --git a/R/check_convergence.R b/R/check_convergence.R index f86bff381..06d0428a0 100644 --- a/R/check_convergence.R +++ b/R/check_convergence.R @@ -107,3 +107,9 @@ check_convergence.glmmTMB <- function(x, ...) { # https://github.com/glmmTMB/glmmTMB/issues/275 isTRUE(x$sdr$pdHess) } + + +#' @export +check_convergence._glm <- function(x, ...) { + isTRUE(x$fit$converged) +}