add_effect_compartment#

pharmpy.modeling.add_effect_compartment(model, expr)[source]#

Add an effect compartment.

Implemented PD models are:

  • Linear:

    \[E = B \cdot (1 + \text{slope} \cdot C)\]
  • Emax:

    \[E = B \cdot \Bigg(1 + \frac {E_{max} \cdot C } { EC_{50} + C} \Bigg)\]
  • Step effect:

    \[E = \Biggl \lbrace {B \quad \text{if C} \leq 0 \atop B \cdot (1+ E_{max}) \quad \text{else}}\]
  • Sigmoidal:

    \[E=\Biggl \lbrace {B \cdot \Bigl(1+\frac{E_{max} \cdot C^n}{EC_{50}^n+C^n}\Bigl) \quad \ \text{if C}>0 \atop B \quad \text{else}}\]
  • Log-linear:

    \[E = \text{slope} \cdot \text{log}(C + C_0)\]

\(B\) is the baseline effect

Parameters:
  • model (Model) – Pharmpy model

  • expr ({‘linear’, ‘emax’, ‘sigmoid’, ‘step’, ‘loglin’}) – Name of the PD effect function.

Returns:

Model – Pharmpy model object

Examples

>>> from pharmpy.modeling import *
>>> model = load_example_model("pheno")
>>> model = add_effect_compartment(model, "linear")
>>> model.statements.ode_system.find_compartment("EFFECT")
Compartment(EFFECT, amount=A_EFFECT(t), input=KE0*A_CENTRAL(t)/VC)