Create a conditional random vectorΒΆ

In this basic example we are going to build a conditional random vector

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

In [6]:
from __future__ import print_function
import openturns as ot
In [7]:
# create the random vector Theta (parameters of X)
gammaDist = ot.Uniform(1.0, 2.0)
alphaDist = ot.Uniform(0.0, 0.1)
thetaDist = ot.ComposedDistribution([gammaDist, alphaDist])
thetaRV = ot.RandomVector(thetaDist)
In [8]:
# create the XgivenTheta distribution
XgivenThetaDist = ot.Exponential()
In [9]:
# create the X distribution
XDist = ot.ConditionalRandomVector(XgivenThetaDist, thetaRV)
In [10]:
# draw a sample
XDist.getSample(5)
Out[10]:
X0
00.24533256712233908
10.6896032414525822
20.9303475410201311
31.501481272030759
40.6301145017187071