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 including random variable itself
Name of VariabilityLevel of the random variables
Names of random variables of distribution
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
- 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)