add_iiv#

pharmpy.modeling.add_iiv(model, list_of_parameters, expression, operation='*', initial_estimate=0.09, eta_names=None)[source]#

Adds IIVs to pharmpy.model.

Effects that currently have templates are:

  • Additive (add)

  • Proportional (prop)

  • Exponential (exp)

  • Logit (log)

  • Rescaled logit (re_log)

For all except exponential the operation input is not needed. Otherwise user specified input is supported. Initial estimates for new etas are 0.09.

Assuming a statement \(CL = \Theta\), IIVs are added in the following ways:

  • Additive: \(CL = \Theta + \eta\)

  • Proportional: \(CL = \Theta \cdot (1 + \eta)\)

  • Exponential: \(CL = \Theta +/\cdot e^{\eta}\)

  • Logit: \(CL = \Theta \cdot e^{\eta}/ (e^{\eta} + 1)\)

  • Rescaled logit: \(CL = e^{\Phi \cdot \eta}/(1+e^{\Phi \cdot \eta})\) with \(\Phi = log(\Theta/(1-\Theta))\)

Parameters:
  • model (Model) – Pharmpy model to add new IIVs to.

  • list_of_parameters (str, list) – Name/names of parameter to add new IIVs to.

  • expression (str, list) – Effect/effects on eta. Either abbreviated (see above) or custom.

  • operation (str, list, optional) – Whether the new IIV should be added or multiplied (default).

  • initial_estimate (float) – Value of initial estimate of parameter. Default is 0.09

  • eta_names (str, list, optional) – Custom name/names of new eta

Returns:

Model – Pharmpy model object

Example

>>> from pharmpy.modeling import *
>>> model = load_example_model("pheno")
>>> model = remove_iiv(model, "CL")
>>> model = add_iiv(model, "CL", "add")
>>> model.statements.find_assignment("CL")
CL = ETA_CL + TVCL