set_power_on_ruv#

pharmpy.modeling.set_power_on_ruv(model, list_of_eps=None, dv=None, lower_limit=0.01, ipred=None, zero_protection=False)[source]#

Applies a power effect to provided epsilons. If a dependent variable is provided, then only said epsilons affecting said variable will be changed.

Initial estimates for new thetas are 1 if the error model is proportional, otherwise they are 0.1.

NOTE : If no DVs or epsilons are specified, all epsilons with the same name will be connected to the same theta. Running the function per DV will give each epsilon a specific theta.

Parameters:
  • model (Model) – Pharmpy model to create block effect on.

  • list_of_eps (str or list or None) – Name/names of epsilons to apply power effect. If None, all epsilons will be used. None is default.

  • dv (Union[Expr, str, int, None]) – Name or DVID of dependent variable. None will change the epsilon on all occurences regardless of affected dependent variable.

  • lower_limit (float or None) – Lower limit of power (theta). None for no limit.

  • ipred (Symbol) – Symbol to use as IPRED. Default is to autodetect expression for IPRED.

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

Returns:

Model – Pharmpy model object

Examples

>>> from pharmpy.modeling import *
>>> model = load_example_model("pheno")
>>> model = set_power_on_ruv(model)
>>> model.statements.find_assignment("Y")
          power₁
Y = EPS₁⋅F       + F

See also

set_iiv_on_ruv