fit.models¶
fit.models_exponential¶
Exponential models of concentration timecourses.
Sums of exponentials describe the decline of a concentration after an
intravenous dose and, with an absorption term, after an extravascular dose
(Gibaldi & Perrier 1982, ch. 1-2; Gabrielsson & Weiner 2016, ch. 3). The
models here are descriptive: the coefficients a_i and rate constants k_i
carry no compartmental interpretation; lambda_z is the smallest rate
constant, t½ = ln 2 / k, and the area is sum a_i / k_i.
MonoExp:y = a e^{-k x}BiExp:y = a1 e^{-k1 x} + a2 e^{-k2 x}withk1 > k2TriExp: three terms withk1 > k2 > k3Bateman:y = a ka / (ka - ke) (e^{-ke t} - e^{-ka t}), the one compartment curve with first order absorption, optionally with a lag time;ka < keis a flip-flop (the terminal phase reflects absorption)
The initial guesses use the method of residuals (curve stripping): the terminal phase is regressed on the last points, its contribution is subtracted and the residuals give the faster phase.
MonoExp
¶
BiExp
¶
Bases: _SumOfExponentials
y = a1 exp(-k1 x) + a2 exp(-k2 x) with k1 > k2.
TriExp
¶
Bases: _SumOfExponentials
y = a1 exp(-k1 x) + a2 exp(-k2 x) + a3 exp(-k3 x) with k1 > k2 > k3.
Bateman
¶
Bases: Model
One compartment with first order absorption: y = a ka/(ka - ke) (e^{-ke t} - e^{-ka t}).
t = max(x - tlag, 0) with the optional lag time. a is the dose over the
apparent volume (D F / V), so auc = a / ke.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
lag
|
bool
|
whether a lag time |
False
|
Create the model with or without a lag time.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
lag
|
bool
|
whether a lag time |
False
|
derived
¶
Time and value of the maximum, half-life, area and the flip-flop indicator.
Computed with numpy under numpy.errstate, so a rate constant of zero,
which a degenerate fit can end at, gives an infinite or undefined value
instead of the ZeroDivisionError of python floats or the ValueError
of math.log.
initial_guess
¶
ke from the terminal phase, ka from the rise (or 5 ke), a from the maximum.
log_linear_regression
¶
Slope and intercept of ln y on x over the finite positive points.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
ndarray
|
independent variable. |
required |
y
|
ndarray
|
dependent variable. |
required |
Returns:
| Type | Description |
|---|---|
tuple[float, float]
|
|
terminal_guess
¶
a and k of the terminal phase from the last half of the points after the maximum.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
ndarray
|
independent variable. |
required |
y
|
ndarray
|
dependent variable. |
required |
Returns:
| Type | Description |
|---|---|
float
|
|
float
|
regression is possible, or when the regression line at |
tuple[float, float]
|
beyond the range of double precision. |
fit.models_response¶
Concentration-effect models (Emax family).
The Emax model E = E0 + Emax C / (EC50 + C) and its sigmoid form with the
Hill coefficient n describe a saturable response (Gabrielsson & Weiner 2016,
ch. 4; Bonate 2011), the exposure-response relationship regulatory guidance
addresses (FDA 2003); Imax is the inhibitory form
E = E0 (1 - Imax C / (IC50 + C)). EC90 = 9^{1/n} EC50 is the concentration
of 90 % of the maximal effect. The same models describe a pharmacokinetic
parameter against an inhibitor dose.
fit.models_linear¶
Linear, log-linear, power and allometric models.
Power (y = a x^b) is the model of dose proportionality (Smith et al.
2000): b = 1 is proportional; proportionality_test in
pkpdutils.fit.proportionality applies the confidence interval criterion.
Allometric is the same model for a parameter against body weight with the
exponent free or fixed (0.75 for clearances, 1 for volumes; Rowland & Tozer
2011, ch. 12). Linear and LogLinear describe an effect or a parameter
against a concentration or covariate.
Linear
¶
LogLinear
¶
Power
¶
Allometric
¶
Bases: Model
y = a x^b against body weight with the exponent free or fixed.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
exponent
|
float | None
|
fixed exponent ( |
None
|
Create the model with a free or a fixed exponent.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
exponent
|
float | None
|
fixed exponent, |
None
|