View source: R/compare_prmNlme.R
| compare_prmNlme | R Documentation |
Builds a single wide table comparing parameter estimates
(and optional %RSE) across two or more NLME runs, alongside a block of
run-level diagnostics (-2LL, OFV diff, method, RetCode,
condition, condition basis, nSub, nObs, and total runtime). It is the multi-model
sibling of get_summaryNlme(): where get_summaryNlme() summarises one
xpose_data object, compare_prmNlme() lines several up side by side for
run-record style model comparison.
compare_prmNlme(
x = NULL,
dir = ".",
runs = NULL,
auto_detect = TRUE,
max_runs = NULL,
transform = c("untransformed", "sqrt_om2", "sqrt_exp_om2_minus_1"),
param_order = c("original", "alphabetical"),
rse_separate = FALSE,
drop_dOFV = FALSE,
output_file = NULL,
format = c("column", "row"),
log_file = "Table_log.txt"
)
x |
Optional named |
dir |
Directory scanned for runs when |
runs |
Optional character vector of run names (subfolders of |
auto_detect |
Logical; when |
max_runs |
Optional cap on the number of successfully loaded runs
to include. |
transform |
One of |
param_order |
One of |
rse_separate |
Logical; when |
drop_dOFV |
Logical; when |
output_file |
Optional path; when set, the full table is written as a
CSV in the chosen |
format |
One of |
log_file |
Name of the excluded-run log written into |
Runs can be supplied three ways:
As a pre-built named list of xpose_data objects (or a single
xpose_data) via x. List names become the column labels.
By explicit run name via runs, loaded from dir with
xposeNlme().
By auto-detection (auto_detect = TRUE, the default when x and
runs are both NULL): dir is scanned for model files (*.mdl or
*.mmdl, case-insensitive) whose same-named run output folder exists,
in alphanumeric order. Name each model so its output folder matches the
model file (e.g. run001.mmdl beside a run001/ folder). A run is
only included when its nlme7engine.log is present; runs that fail to
load are recorded in log_file (written into dir) and skipped.
The transform setting affects only diagonal OMEGA rows. Diagonal SIGMA
rows are kept on the reported get_prmNlme() scale (for CEps this is the
SD scale), so SIGMA values and %RSE do not change across transformation
settings. %RSE on transformed OMEGA is propagated with the delta method.
The returned object carries n_header / n_rse attributes marking the
leading diagnostic block and the trailing RSE block, which
as_flextable.prmComparisonNlme() uses to draw separators. Rendering with
flextable and CSV export via output_file are both optional; the core
computation depends only on packages already imported by
Certara.Xpose.NLME.
The diagnostic row total runtime (sec) is engine-reported CPU time:
the sum of the runtime and covtime rows in xpdb$summary, which are
parsed from nlme7engine.log at import. That total can differ
substantially from the wall-clock elapsed time shown by
print.rsnlme_fit / a fit object's runTime (especially on multi-core
runs). See also get_overallNlme() for the same distinction, including
optional runtime_wallclock when an xpdb was built via
xposeNlmeModel().
A tibble of class prmComparisonNlme with a Description column
followed by one column per run, carrying n_header, n_rse, nModels,
run_labels, and format attributes.
get_summaryNlme(), get_prmNlme(), get_overallNlme(),
xposeNlme()
## Not run:
# 1) Compare two already-imported runs.
xp1 <- xposeNlme(dir = "run001")
xp2 <- xposeNlme(dir = "run002")
compare_prmNlme(list(run001 = xp1, run002 = xp2))
# 2) Auto-detect every completed run under the working directory,
# put %RSE on its own rows, and write a CSV.
tbl <- compare_prmNlme(
rse_separate = TRUE,
output_file = "TableofParameters.csv"
)
# 3) Render the comparison as a flextable (requires the flextable and
# officer packages).
flextable::as_flextable(tbl)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.