has_random_effect#

pharmpy.modeling.has_random_effect(model, parameter, level='all')[source]#

Decides whether the given parameter of a pharmpy.model has a random effect.

Parameters:
  • model (Model) – Input Pharmpy model

  • parameter (str) – Input parameter

  • level ({‘iiv’, ‘iov’, ‘all’}) – The variability level to look for: ‘iiv’, ‘iov’, or ‘all’ (default)

Returns:

bool – Whether the given parameter has a random effect

Example

>>> from pharmpy.modeling import *
>>> model = load_example_model("pheno")
>>> has_random_effect(model, 'S1')
True
>>> has_random_effect(model, 'CL', 'iiv')
True
>>> has_random_effect(model, 'CL', 'iov')
False