Skip to contents

is_converged() is a compact programmatic flag for workflows that need a yes/no answer before comparing, displaying, or post-processing a drmTMB fit. By default it checks only stored optimizer status: the nlminb() convergence code must be 0 and the stored objective and log-likelihood must be finite.

Usage

is_converged(object, ...)

# Default S3 method
is_converged(object, ...)

# S3 method for class 'drmTMB'
is_converged(object, include_hessian = FALSE, ...)

Arguments

object

A drmTMB fit.

...

Reserved for future convergence options.

include_hessian

Logical; require a positive-definite TMB::sdreport() Hessian in addition to optimizer convergence.

Value

A single logical value.

Details

Set include_hessian = TRUE when the next step needs Wald-style uncertainty. In that mode, is_converged() also requires successful TMB::sdreport() output with pdHess = TRUE. A fit can therefore be optimizer-converged while still returning FALSE with include_hessian = TRUE; this marks an inference-readiness problem, not automatic proof that point estimates are unusable.

Use check_drm() when you need the full diagnostic table and messages.

Examples

set.seed(20260531)
dat <- data.frame(y = rnorm(30), x = rnorm(30))
fit <- drmTMB(bf(y ~ x, sigma ~ 1), data = dat)
is_converged(fit)
#> [1] TRUE
is_converged(fit, include_hessian = TRUE)
#> [1] TRUE