Create a conditional distributionΒΆ

In this basic example we are going to build a conditional distribution in the form

\underline{X}|\underline{\Theta}

with X conditioned by the random variable Theta obtained with the random variable Y through a function f

\underline{\Theta}=f(\underline{Y})

In [13]:
from __future__ import print_function
import openturns as ot
In [14]:
# create the Y distribution
YDist = ot.Normal(0.0, 1.0)
In [15]:
# create Theta=f(y)
f = ot.SymbolicFunction(['y'], ['y', '0.1+y^2'])
In [16]:
# create the X|Theta distribution
XgivenThetaDist = ot.Normal()
In [17]:
# create the distribution
XDist = ot.ConditionalDistribution(XgivenThetaDist, YDist, f)
print(XDist)
ConditionalDistribution(X with X|Theta~Normal(Theta), Theta=f(Y), f=[y]->[y,0.1+y^2], Y~Normal(mu = 0, sigma = 1))
In [18]:
# draw PDF
XDist.drawPDF()
Out[18]:
../../_images/examples_probabilistic_modeling_conditional_distribution_7_0.svg