set_combined_error_model#

pharmpy.modeling.set_combined_error_model(model, dv=None, data_trans=None)[source]#

Set a combined error model. Initial estimates for new sigmas are \((min(DV)/2)²\) for proportional and 0.09 for additive.

The error function being applied depends on the data transformation.

Data transformation

Combined error

\(y\)

\(f + f \epsilon_1 + \epsilon_2\)

\(log(y)\)

\(\log(f) + \epsilon_1 + \frac{\epsilon_2}{f}\)

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.

Returns:

Model – Pharmpy model object

Examples

>>> from pharmpy.modeling import *
>>> model = remove_error_model(load_example_model("pheno"))
>>> model = set_combined_error_model(model)
>>> model.statements.find_assignment("Y")
Y = F⋅εₚ + F + εₐ
>>> from pharmpy.modeling import *
>>> model = remove_error_model(load_example_model("pheno"))
>>> model = set_combined_error_model(model, data_trans="log(Y)")
>>> model.statements.find_assignment("Y")
                 εₐ
   εₚ + log(F) + ──
Y =              F

See also

set_additive_error_model

Additive error model

set_proportional_error_model

Proportional error model