| nonmem_scaling | R Documentation |
Given the units used in your dataset/model for the dependent variable (DV,
a concentration like "ng/mL"), the dosing amount (AMT, e.g. "mg") and the
model volume parameter V (e.g. "L" or "mL"), this function returns a robust
NONMEM-ready S1 expression so that A(n)/S1 has the same units as DV.
The function:
parses common unit notations and synonyms (e.g. "ug", "mcg"),
validates input and provides informative errors,
computes the numeric factor such that S1 = V * factor,
returns a human-readable explanation and an optional numeric example.
nonmem_scaling(
dv_unit,
amt_unit,
v_unit,
sig_digits = 8L,
example = FALSE,
example_amt = 1,
example_v = 1
)
dv_unit |
Character scalar. DV concentration unit, e.g. "ng/mL", "mg/L", "ug per mL". |
amt_unit |
Character scalar. AMT unit (mass), e.g. "mg", "ug", "ng". |
v_unit |
Character scalar. Unit for model volume parameter V, e.g. "L", "mL". |
sig_digits |
Integer scalar. Significant digits for formatted output (default = 8). |
example |
Logical scalar. If TRUE, include a numeric example (default = FALSE). |
example_amt |
Numeric scalar. Example AMT value (default = 1). |
example_v |
Numeric scalar. Example V value (default = 1). |
Compute NONMEM S1 scaling from concentration, amount, and volume units
A list with elements:
Numeric. The multiplicative factor such that S1 = V * factor.
Character. NONMEM-ready expression (e.g. "S1 = V/1000").
Character. Human-readable explanation of the derivation.
Named list (present only when example = TRUE) with numeric example.
# Typical PK: DV in ng/mL, AMT in mg, V in L -> S1 = V * 1e+06 / 1000 = V * 1000
nonmem_scaling("ng/mL", "mg", "L")
# If V is stored in mL:
nonmem_scaling("ng/mL", "mg", "mL")
# With numeric example
nonmem_scaling("ng/mL", "mg", "L", example = TRUE, example_amt = 100, example_v = 40)
# Microgram dosing
nonmem_scaling("pg/mL", "ug", "L")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.