Create a deconditioned distributionΒΆ

In this example we are going to build the distribution of the random vector \inputRV defined by the conditional distribution of:

\inputRV|\vect{\Theta}

where \vect{\Theta} is the output of the random variable \vect{Y} through the link function f:

\vect{\Theta} & = f(\vect{Y})\\
\vect{Y} & \sim \cL_{\vect{Y}}

This example creates a DeconditionedDistribution which offers all the methods attached to the distributions.

We consider the case where X is of dimension 1 and follows a uniform distribution defined by:

Variable

Distribution

Parameter

X

Uniform (a, b)

(a,b) = (Y, 1+Y^2)

Y

Uniform (c, d)

(c,d) = (-1, 1)

import openturns as ot
import openturns.viewer as otv

Create the Y distribution.

YDist = ot.Uniform(-1.0, 1.0)

Create the link function f: y \rightarrow (y, 1+y^2).

f = ot.SymbolicFunction(["y"], ["y", "1+y^2"])

Create the conditional distribution of \vect{X}|\vect{\Theta}: as the parameters have no importance, we use the default distribution.

XgivenThetaDist = ot.Uniform()

Create the deconditioned distribution of X.

XDist = ot.DeconditionedDistribution(XgivenThetaDist, YDist, f)
XDist.setDescription([r"$X|\mathbf{\boldsymbol{\Theta}} = f(Y)$"])
XDist
DeconditionedDistribution
  • name=DeconditionedDistribution
  • dimension=1
  • weight=1
  • range=[-0.998771, 1.99754]
  • description=[$X|\mathbf{\boldsymbol{\Theta}} = f(Y)$]
  • isParallel=true
  • isCopula=false


Get a sample:

XDist.getSample(5)
$X|\mathbf{\boldsymbol{\Theta}} = f(Y)$
00.9728113
1-0.655941
21.050775
31.277257
4-0.101663


Draw the PDF.

graph = XDist.drawPDF()
view = otv.View(graph)
plot deconditioned distribution
view.ShowAll()