Reads a portable .fitrx archive written by ferx_save_fit (or by the ferx-core Rust CLI's --output flag) and reconstructs a ferx_fit-classed list. The returned object is structurally compatible with one returned by ferx_fit for the fields covered by the cross-language schema, plus any R-specific fields the writer preserved under r_extras.

ferx_load_fit(path)

Arguments

path

Path to a .fitrx file.

Value

A ferx_fit-classed list.

Details

To call ferx_predict on a loaded fit, the embedded model source can be re-parsed through the existing pipeline.

See also

Examples

ex  <- ferx_example("warfarin")
fit <- ferx_fit(ex$model, ex$data, method = "gn", covariance = FALSE)
#> Warning: Model file [fit_options] sets `method = foce` but ferx_fit() argument overrides it with `gn`. The call-time value will be used.
#> Warning: Model file [fit_options] sets `covariance = true` but ferx_fit() argument overrides it with `false`. The call-time value will be used.
#> Mu-referencing detected for: ETA_CL, ETA_KA, ETA_V
#> Negative IWRES autocorrelation detected (Durbin-Watson = 2.61, lag-1 r = -0.37).
#> Possible over-parameterisation or misspecified residual error model.
tmp <- tempfile(fileext = ".rds")
ferx_save_fit(fit, tmp)
fit2 <- ferx_load_fit(tmp)
identical(fit$theta, fit2$theta)
#> [1] FALSE