Runs fun (a function of no arguments returning a fit) reps times, reports the
spread, and CHECKS that the numerical results are identical across runs, a timing
whose results differ between replicates is measuring two different things.
Usage
benchmark_fit(fun, reps = 3)
Arguments
- fun
function of no arguments, e.g. function() model(y ~ cg + animal(id), d, p)
- reps
replicates, at least 3 (fewer is a declared error, not a default to
argue with: one timing on a busy machine can be off by 70 percent)
Value
list with seconds (all runs), min/median/max, identical (TRUE when
every run returned bit-identical components), and fit (the first run's result)