Note
Go to the end to download the full example code.
Create a conditional distributionΒΆ
In this example we are going to build the distribution of the random vector conditioned by the random vector
with obtained with the random variable through a function
import openturns as ot
import openturns.viewer as viewer
from matplotlib import pylab as plt
Create the distribution
YDist = ot.Uniform(-1.0, 1.0)
Create
f = ot.SymbolicFunction(["y"], ["y", "1+y^2"])
Create the distribution
XgivenThetaDist = ot.Uniform()
create the distribution
XDist = ot.DeconditionedDistribution(XgivenThetaDist, YDist, f)
XDist.setDescription(["X|Theta=f(y)"])
XDist
Get a sample
XDist.getSample(5)
Draw PDF
graph = XDist.drawPDF()
view = viewer.View(graph)
plt.show()