Allometric scaling
Description
Adds allometric body-size scaling to a model: (WT/70)^0.75 on every clearance the pk template line binds (cl, q, q2, q3) and (WT/70)^1.0 on every volume (v, v1, v2, v3), written as [covariate_model] relations. This is Pharmpy’s allometry tool, and it is a convention rather than new machinery - the same thing you would write by hand as power(center = 70, fix = 0.75).
Usage
ferx_allometry(
model = NULL,
data = NULL,
config = NULL,
covariate = NULL,
reference = NULL,
parameters = NULL,
exponents = NULL,
estimate = FALSE,
lower = NULL,
upper = NULL,
fit = TRUE,
threads = NULL,
retries = NULL,
directory = NULL
)
# S3 method for ferx_allometry
print(x, digits = 4, ...)Arguments
model: Path to a.ferxmodel, or aferx_modelobject. Omit whenconfigis given.data: Path to the dataset. Defaults to the model’s[data]block. Names the dataset the search runs on, so likemodelit cannot be given besideconfig- the file’s owndatakey says which dataset that file searches.config: Path to a.ferxsearchfile carrying anALLOMETRY(WT, 70)statement and an optional[allometry]section. Mutually exclusive with the arguments that state the scaling.covariate: The size covariate (engine default"WT").reference: The reference value it is divided by (engine default 70).parameters: Parameters to scale.NULLtakes every clearance and volume the template line binds.exponents: One exponent perparametersentry.NULLuses the convention: 0.75 for a clearance, 1.0 for a volume.estimate: Estimate the exponents from those values instead of fixing them, bounded bylowerandupper.lower, upper: Bounds of an estimated exponent (engine defaults 0 and 2).fit: Fit the base and scaled models, or only build the scaled one.threads: Total worker threads.NULLlets the runner choose.retries: Perturbed restarts per fit on top of the exact one.NULLkeeps the engine default.directory: Where the two fits are journalled.NULLkeeps them in memory.x: Aferx_allometryobject.digits: Significant digits for the printed tables....: Ignored.
Details
With fit = FALSE this is a model transform: you get the scaled model text back and nothing is fitted, so allometry can be one step of a hand-built workflow. With fit = TRUE (the default) the base and the scaled model are fitted side by side and both outcomes are returned, which is what makes the scaling’s cost visible. A parameter that already carries a relation on the size covariate is left alone, as Pharmpy does, with a note saying so.
Seealso
[ferx_covsearch](ferx_covsearch.qmd), [ferx_search_config](ferx_search_config.qmd)Other search: [ferx_amd](ferx_amd.qmd), [ferx_amd_plan](ferx_amd_plan.qmd), [ferx_covsearch](ferx_covsearch.qmd), [ferx_globalsearch](ferx_globalsearch.qmd), [ferx_iivsearch](ferx_iivsearch.qmd), [ferx_iovsearch](ferx_iovsearch.qmd), [ferx_modelsearch](ferx_modelsearch.qmd), [ferx_ruvsearch](ferx_ruvsearch.qmd), [ferx_search_config](ferx_search_config.qmd), [ferx_search_coverage](ferx_search_coverage.qmd), [ferx_search_results](ferx_search_results.qmd), [ferx_search_space](ferx_search_space.qmd)
Concept
search
Value
An object of class ferx_allometry:
- scalings: One row per scaled parameter:
parameter,exponent,fixedand thethetaan estimated exponent declares. - model, model_path: The scaled model as text, and as a file.
- covariate, reference: The scaling the relations were built on.
- comparison: With
fit = TRUE: the two fits side by side -model("base"/"scaled"),ofv,converged,passedandfailures. - fit, base_fit: With
fit = TRUE: the scaled and base fits asferx_fitobjects. - dofv:
OFV(base) - OFV(scaled), when both fits exist. - notes, cancelled: Parameters left alone and why, and whether the run was stopped early.
Examples
ex <- ferx_example("warfarin")
# The transform on its own: the scaled model, nothing fitted
scaled <- ferx_allometry(ex$model, ex$data, fit = FALSE)
cat(scaled$model)
# The tool: both fits, side by side
res <- ferx_allometry(ex$model, ex$data, covariate = "WT", reference = 70)
res
res$comparison