set_proportional_error_model#

pharmpy.modeling.set_proportional_error_model(model, dv=None, data_trans=None, zero_protection=True)[source]#

Set a proportional error model. Initial estimate for new sigma is 0.09.

The error function being applied depends on the data transformation.

Data transformation

Proportional error

\(y\)

\(f + f \epsilon_1\)

\(log(y)\)

\(\log(f) + \epsilon_1\)

Parameters:
  • model (Model) – Set error model for this model

  • dv (Union[Expr, str, int, None]) – Name or DVID of dependent variable. None for the default (first or only)

  • data_trans (str or expression) – A data transformation expression or None (default) to use the transformation specified by the model.

  • zero_protection (bool) – Set to True to add code protecting from IPRED=0

Returns:

Model – Pharmpy model object

Examples

>>> from pharmpy.modeling import *
>>> model = remove_error_model(load_example_model("pheno"))
>>> model = set_proportional_error_model(model)
>>> model.statements.after_odes
    A_CENTRAL(t)
    ────────────
F =      S₁
           ⎧2.225e-16  for F = 0

IPREDADJ = ⎩    F      otherwise
Y = F + IPREDADJ⋅εₚ
>>> from pharmpy.modeling import *
>>> model = remove_error_model(load_example_model("pheno"))
>>> model = set_proportional_error_model(
...     model,
...     data_trans="log(Y)"
... )
>>> model.statements.after_odes
    A_CENTRAL(t)
    ────────────
F =      S₁
           ⎧2.225e-16  for F = 0

IPREDADJ = ⎩    F      otherwise
Y = εₚ + log(IPREDADJ)

See also

set_additive_error_model

Additive error model

set_combined_error_model

Combined error model