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

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()