NormalDistribution#

class pharmpy.model.NormalDistribution(name, level, mean, variance)[source]#

Bases: Distribution

Normal distribution for one random variable

Parameters:
  • name (str) – Name of the random variable

  • level (str) – Name of the variability level

  • mean (expression or number) – Mean of the random variable

  • variance (expression or number) – Variance of the random variable

Example

>>> from pharmpy.model import NormalDistribution, Parameter
>>> omega = Parameter.create('OMEGA_CL', 0.1)
>>> dist = NormalDistribution.create("IIV_CL", "IIV", 0, omega.symbol)
>>> dist
IIV_CL ~ N(0, OMEGA_CL)

Attributes Summary

free_symbols

Free symbols including random variable itself

level

Name of VariabilityLevel of the random variables

mean

names

Names of random variables of distribution

variance

Methods Summary

create(name, level, mean, variance)

evalf(parameters)

from_dict(d)

get_covariance(name1, name2)

get_variance(name)

latex_string([aligned])

replace(**kwargs)

Replace properties and create a new NormalDistribution

subs(d)

Substitute expressions

to_dict()

Attributes Documentation

free_symbols#

Free symbols including random variable itself

level#
mean#
names#
variance#

Methods Documentation

classmethod create(name, level, mean, variance)[source]#
evalf(parameters)[source]#
classmethod from_dict(d)[source]#
get_covariance(name1, name2)[source]#
get_variance(name)[source]#
latex_string(aligned=False)[source]#
replace(**kwargs)[source]#

Replace properties and create a new NormalDistribution

subs(d)[source]#

Substitute expressions

Parameters:

d (dict) – Dictionary of from: to pairs for substitution

Examples

>>> import sympy
>>> from pharmpy.model import NormalDistribution, Parameter
>>> omega = Parameter.create("OMEGA_CL", 0.1)
>>> dist = NormalDistribution.create("IIV_CL", "IIV", 0, omega.symbol)
>>> dist = dist.subs({omega.symbol: sympy.Symbol("OMEGA_NEW")})
>>> dist
IIV_CL ~ N(0, OMEGA_NEW)
to_dict()[source]#