set_direct_effect#

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

Add an effect to a model.

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 PD effect function.

Returns:

Model – Pharmpy model object

Examples

>>> from pharmpy.modeling import *
>>> model = load_example_model("pheno")
>>> model = set_direct_effect(model, "linear")
>>> model.statements.find_assignment("E")
      ⎛SLOPE⋅A_CENTRAL(t)    ⎞
    B⋅⎜────────────────── + 1⎟
E =   ⎝        VC            ⎠