nca.options¶
Options and flags of the non-compartmental analysis.
NCAOptions selects the methods of an analysis: the kind of timecourse, the
trapezoid rule, the terminal phase selection, the handling of values below the
limit of quantification (BLQRules, one rule per position of the curve) and
the dosing intervals of a multiple dose analysis. NCAFlag names the
conditions an analysis reports per sample instead of raising or warning.
Kind
¶
Bases: StrEnum
What a timecourse measures.
AUCMethod
¶
Bases: StrEnum
Trapezoid rule of the areas, see docs/nca.md.
TerminalMethod
¶
Bases: StrEnum
Selection of the points of the terminal log-linear regression.
BLQHandling
¶
Bases: StrEnum
Handling of values below the lower limit of quantification.
BLQAction
¶
Bases: StrEnum
What happens to a value below the lower limit of quantification.
The action of a position of the curve (BLQRules); a float in place of
a member imputes that number. DROP and KEEP leave no imputed value
behind, every other action writes one, which enters the areas and, unless
BLQRules.terminal_regression, stays out of the terminal regression.
C0Method
¶
Bases: StrEnum
Estimate of the concentration at time 0 after an intravenous bolus.
UncertaintyMethod
¶
Bases: StrEnum
How the uncertainty of group timecourses is propagated to the parameters.
BootstrapSpread
¶
Bases: StrEnum
Which spread the bootstrap resamples every time point with.
BootstrapDistribution
¶
Bases: StrEnum
Distribution the bootstrap draws every time point from.
NCAFlag
¶
Bases: IntFlag
Conditions reported per sample in the flags variable of a result.
BLQRules
¶
Bases: BaseModel
Rules for the values below the lower limit of quantification, by position.
The tools slice a profile on two incompatible axes and a rule set is expressed on one of them, never on both (the model raises for a mixture):
- the positional axis
first,middle,last: the values before the first measurable value, between two measurable values and after the last measurable value (PKNCAconc.blqwith"first"/"middle"/"last", PumasDict(:first => :keep, :middle => :drop, :last => :keep)); - the tmax axis
before_tmax,after_tmax, split at the maximum of the measurable values (PKNCA"before.tmax"/"after.tmax", PKanalix, which imputes 0 before andLLOQ/2after the maximum).
A rule is a BLQAction or a number, which is imputed as it is; a position
without a rule drops its values. A row whose values are all below the limit
has no measurable value: every value of it counts as first on the
positional axis and as after_tmax on the tmax axis.
An imputed value enters the areas (auc_all reports what the imputation
added to the tail) and stays out of the terminal regression unless
terminal_regression is set; a value which BLQAction.KEEP keeps is
treated the same way, since a value below the limit of quantification is
not a quantified value. ICH M13A (2024) asks for exactly that: values below
the limit are "treated as zero in PK parameter calculations" and "omitted
from the calculation of kel and t½" (BLQRules.ich_m13a).
Attributes:
| Name | Type | Description |
|---|---|---|
first |
BLQAction | float | None
|
rule for the values before the first measurable value |
middle |
BLQAction | float | None
|
rule for the values between two measurable values |
last |
BLQAction | float | None
|
rule for the values after the last measurable value |
before_tmax |
BLQAction | float | None
|
rule for the values before the maximum |
after_tmax |
BLQAction | float | None
|
rule for the values at or after the maximum |
terminal_regression |
bool
|
whether an imputed or kept value below the limit may enter the terminal regression |
from_handling
classmethod
¶
The rules of one of the two classic BLQHandling values.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
handling
|
BLQHandling
|
|
required |
Returns:
| Type | Description |
|---|---|
BLQRules
|
|
BLQRules
|
|
ich_m13a
classmethod
¶
Acceptance
¶
Bases: BaseModel
Thresholds a sample has to meet for its terminal phase to be accepted.
A regulatory analysis does not report every terminal regression it can
compute: the adjusted \(R^2\) of the regression, the extrapolated share of
\(\mathrm{AUC}_{0\text{-}\infty}\), the number of half-lives the window
covers and the number of points of the regression are checked against
thresholds, and the samples which fail them are reported separately or left
out of the summary statistics. PKanalix ships the four thresholds of
Acceptance.pkanalix as its defaults and restricts its summary statistics
to the individuals which meet them; Phoenix WinNonlin has the same three
continuous criteria with an Accepted/Not_Accepted flag and ships no
thresholds; PKNCA spells them as the exclusion rules
exclude_nca_min.hl.adj.r.squared(), exclude_nca_max.aucinf.pext(),
exclude_nca_span_ratio() and exclude_nca_count_conc_measured().
Every threshold is None by default, so the default analysis accepts every
sample, and a threshold which is set is checked only where the sample
carries the value (a sample without a terminal phase has no adjusted
\(R^2\), so it fails the criterion).
Attributes:
| Name | Type | Description |
|---|---|---|
r2_adj_min |
float | None
|
smallest adjusted \(R^2\) of the terminal regression
( |
extrapolation_max |
float | None
|
largest extrapolated fraction \((\mathrm{AUC}_{0\text{-}\infty,\mathrm{pred}} - \mathrm{AUC}_{0\text{-}t_\mathrm{last}}) / \mathrm{AUC}_{0\text{-}\infty,\mathrm{pred}}\), the predicted variant PKanalix and Phoenix check |
span_min |
float | None
|
smallest number of half-lives the terminal window covers
( |
n_points_min |
int | None
|
smallest number of points of the terminal regression
( |
exclude |
bool
|
whether a sample which is not accepted is also marked
|
pkanalix
classmethod
¶
The default thresholds of PKanalix.
Adjusted \(R^2\) of at least 0.98, at most 20 % extrapolated area, a span of at least 3 half-lives and at least 3 points of the regression.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
exclude
|
bool
|
whether a sample which fails a threshold is also excluded. |
False
|
Returns:
| Type | Description |
|---|---|
Acceptance
|
The thresholds. |
TerminalPhase
¶
Bases: BaseModel
Selection of the points of the terminal log-linear regression.
After an intravenous infusion the samples taken at or before the end of the
infusion (t <= t_dose + dose_duration) are no candidates of any window,
whatever method says: the concentration still rises while the drug is
given, so the first point a window may start at is the first sample
strictly after the infusion (Phoenix WinNonlin). It is the only rule of the
selection which the route decides.
Attributes:
| Name | Type | Description |
|---|---|---|
method |
TerminalMethod
|
the selection rule |
min_points |
int
|
minimal number of points of a regression (at least 3) |
exclude_cmax |
bool
|
whether the windows must start after the point of the
maximum ( |
n_points |
int | None
|
number of points for |
points |
tuple[int, ...] | None
|
indices of the points (in the time order of the curve) for |
min_adj_r2 |
float | None
|
minimal adjusted R² a regression must reach, |
tie_tolerance |
float
|
a window with more points wins over the best adjusted R² when its adjusted R² is within this tolerance of the best |
windows |
dict[Any, tuple[float, float]] | None
|
the terminal window |
keep_candidates |
bool
|
whether the regression keeps the table of every
candidate window instead of the chosen one alone
( |
NCAOptions
¶
Bases: BaseModel
Options of a non-compartmental analysis.
Attributes:
| Name | Type | Description |
|---|---|---|
kind |
Kind
|
concentration or effect timecourses |
auc_method |
AUCMethod
|
trapezoid rule of the areas |
terminal |
TerminalPhase
|
selection of the terminal phase |
lloq |
float | None
|
lower limit of quantification in the unit of the values, |
blq |
BLQHandling | BLQRules
|
handling of values below |
c0_method |
C0Method
|
estimate of C(0) after an intravenous bolus |
extrapolation_warning |
float
|
fraction of AUC(0-inf) above which |
acceptance |
Acceptance
|
thresholds of the terminal phase every sample is checked
against ( |
partial_aucs |
dict[str, tuple[float, float]]
|
named partial areas, name to |
tau |
float | None
|
length of the last dosing interval, |
tau_tolerance |
float
|
how far the last sample of the analysed dosing interval
may fall short of its end, as a fraction of |
intervals |
bool
|
whether the per-interval parameters ( |
units |
dict[str, str]
|
reporting units of the result, variable name to unit
( |
effect_threshold |
float | None
|
threshold of |
n_workers |
int | None
|
workers of the analysis. |
chunk_rows |
int
|
most rows of a chunk of the vectorized core, which bounds
its memory: a run holds the temporaries of as many chunks as run
at once, |
uncertainty |
UncertaintyMethod | None
|
propagation of |
n_boot |
int
|
number of bootstrap replicates |
seed |
int | None
|
seed of the bootstrap random generator; the default |
ci_level |
float
|
level of the confidence intervals |
bootstrap_spread |
BootstrapSpread
|
whether the replicates are drawn with |
bootstrap_distribution |
BootstrapDistribution
|
normal or log-normal draws |
delta_step |
float
|
relative perturbation of a point, in units of its |
blq_rules
property
¶
resolve_uncertainty
¶
The uncertainty method of an analysis.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
has_uncertainty
|
bool
|
whether the batch carries |
required |
Returns:
| Type | Description |
|---|---|
UncertaintyMethod
|
|
UncertaintyMethod
|
uncertainty and |
decode_flags
¶
Names of the flags set in an integer flag value, in bit order.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
int
|
an integer combination of |
required |
Returns:
| Type | Description |
|---|---|
list[str]
|
The names of the set flags, in the declaration order of |