Note
Go to the end to download the full example code.
Create a deconditioned distributionΒΆ
In this example we are going to build the distribution of the random vector
defined by the conditional distribution of:
where is the output of the random variable
through the link
function
:
This example creates a DeconditionedDistribution
which offers all the methods
attached to the distributions.
We consider the case where is of dimension 1 and follows a uniform distribution defined
by:
Variable |
Distribution |
Parameter |
---|---|---|
|
||
|
import openturns as ot
import openturns.viewer as otv
Create the distribution.
YDist = ot.Uniform(-1.0, 1.0)
Create the link function .
f = ot.SymbolicFunction(["y"], ["y", "1+y^2"])
Create the conditional distribution of : as the parameters have no
importance, we use the default distribution.
XgivenThetaDist = ot.Uniform()
Create the deconditioned distribution of .
XDist = ot.DeconditionedDistribution(XgivenThetaDist, YDist, f)
XDist.setDescription([r"$X|\mathbf{\boldsymbol{\Theta}} = f(Y)$"])
XDist
Get a sample:
XDist.getSample(5)
Draw the PDF.
graph = XDist.drawPDF()
view = otv.View(graph)
view.ShowAll()