set_direct_effect#

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

Add an effect to a model.

Effects are by default using concentratrion, but any user specified variable in the model can be used. Implemented PD models are:

  • Linear:

    E=B(1+slopeC)
  • Emax:

    E=B(1+EmaxCEC50+C)
  • Step effect:

    E={Bif C0B(1+Emax)else
  • Sigmoidal:

    E={B(1+EmaxCnEC50n+Cn) if C>0Belse
  • Log-linear:

    E=slopelog(C+C0)

B is the baseline effect

Parameters:
  • model (Model) – Pharmpy model

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

  • variable (str) – Name of variable to use (if None concentration will be used)

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            ⎠