create_joint_distribution#

pharmpy.modeling.create_joint_distribution(model, rvs=None, individual_estimates=None)[source]#

Combines some or all etas into a joint distribution.

The etas must be IIVs and cannot be fixed. Initial estimates for covariance between the etas is dependent on whether the model has results from a previous run. In that case, the correlation will be calculated from individual estimates, otherwise correlation will be set to 10%.

Parameters:
  • model (Model) – Pharmpy model

  • rvs (list) – Sequence of etas or names of etas to combine. If None, all etas that are IIVs and non-fixed will be used (full block). None is default.

  • individual_estimates (pd.DataFrame) – Optional individual estimates to use for calculation of initial estimates

Returns:

Model – Pharmpy model object

Examples

>>> from pharmpy.modeling import load_example_model, create_joint_distribution
>>> model = load_example_model("pheno")
>>> model.random_variables.etas
ETA₁ ~ N(0, IVCL)
ETA₂ ~ N(0, IVV)
>>> model = create_joint_distribution(model, ['ETA_1', 'ETA_2'])
>>> model.random_variables.etas
⎡ETA₁⎤    ⎧⎡0⎤  ⎡    IVCL      IIV_CL_IIV_V⎤⎫
⎢    ⎥ ~ N⎪⎢ ⎥, ⎢                          ⎥⎪
⎣ETA₂⎦    ⎩⎣0⎦  ⎣IIV_CL_IIV_V      IVV     ⎦⎭

See also

split_joint_distribution

split etas into separate distributions