set_additive_error_model#

pharmpy.modeling.set_additive_error_model(model, dv=None, data_trans=None, series_terms=2)[source]#

Set an additive error model. Initial estimate for new sigma is \((min(DV)/2)²\).

The error function being applied depends on the data transformation. The table displays some examples.

Data transformation

Additive error

\(y\)

\(f + \epsilon_1\)

\(log(y)\)

\(\log(f) + \frac{\epsilon_1}{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. Series expansion will be used for approximation.

  • series_terms (int) – Number of terms to use for the series expansion approximation for data transformation.

Returns:

Model – Pharmpy model object

Examples

>>> from pharmpy.modeling import set_additive_error_model, load_example_model
>>> model = load_example_model("pheno")
>>> model.statements.find_assignment("Y")
Y = EPS₁⋅F + F
>>> model = set_additive_error_model(model)
>>> model.statements.find_assignment("Y")
Y = F + εₐ
>>> from pharmpy.modeling import set_additive_error_model, load_example_model
>>> model = load_example_model("pheno")
>>> model.statements.find_assignment("Y")
Y = EPS₁⋅F + F
>>> model = set_additive_error_model(model, data_trans="log(Y)")
>>> model.statements.find_assignment("Y")
             εₐ
    log(F) + ──
Y =          F

See also

set_proportional_error_model

Proportional error model

set_combined_error_model

Combined error model