compare_grads: Compare Automatic and Numerical Differentiation

View source: R/tmbutils.R

compare_gradsR Documentation

Compare Automatic and Numerical Differentiation

Description

Compare differences in gradients of loss functions computed using automatic and numerical differentiation

Usage

compare_grads(model, tolerance = 1e-05, tmb_pars = NULL, ...)

compare_hessians(model, tolerance = 1e-05, tmb_pars = NULL, ...)

Arguments

model

flexmodel

tolerance

numerical tolerance to pass to all.equal – if NA, then a list is returned that can be passed to all.equal using do.call

tmb_pars

optional parameters to pass to the tmb functions

...

additional arguments to pass to numDeriv::grad

Value

either (1) the return value of all.equal comparing gradients using TMB auto differentiation to numDeriv::grad if is.numeric(tolerance), or (2) a list is returned that can be passed to all.equal using do.call if is.na(tolerance)

See Also

Other compare: compare_sims(), time_wrap()


bbolker/McMasterPandemic documentation built on Aug. 25, 2024, 6:35 p.m.