Runs a short pilot fit (5 or 20 outer iterations depending on the method) with optimizer_trace = TRUE so you can inspect how the optimizer moves from the initial parameter values before committing to a full fit. Useful for diagnosing poor starting values, ill-scaled parameters, or structural model issues.

ferx_check_init(model, data = NULL, method = "focei", maxiter = NULL, ...)

Arguments

model

Path to a .ferx model file, or a ferx_model object created by ferx_model. When a ferx_model is passed and data is not supplied, the data path on the object is used.

data

Path to a NONMEM-format CSV file. Optional when model is a ferx_model that already carries a data path.

method

Estimation method string, passed to ferx_fit. Default "focei".

maxiter

Maximum iterations for the pilot fit. Default: 5 for gradient-based methods, 20 for SAEM (to get a meaningful accept-rate trajectory).

...

Additional arguments forwarded verbatim to ferx_fit (e.g. threads, settings).

Value

A named list with:

fit

The ferx_fit object from the pilot run

trace

The trace data frame (from ferx_trace)

summary

A one-row data frame with n_iter, ofv_start, ofv_end, ofv_drop, and converged

Examples

if (FALSE) { # \dontrun{
# Plain paths
chk <- ferx_check_init("warfarin.ferx", "warfarin.csv")
ferx_plot_trace(chk$fit)
chk$summary

# Pipe from a ferx_model — data is picked up from the object
ex <- ferx_example("warfarin")
ex$data |>
  ferx_model(ex$model) |>
  ferx_check_init(method = "focei")
} # }