Create a conditional random vectorΒΆ

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

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

[6]:
from __future__ import print_function
import openturns as ot
[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)
[8]:
# create the XgivenTheta distribution
XgivenThetaDist = ot.Exponential()
[9]:
# create the X distribution
XDist = ot.ConditionalRandomVector(XgivenThetaDist, thetaRV)
[10]:
# draw a sample
XDist.getSample(5)
[10]:
X0
00.24533256712233908
10.6896032414525822
20.9303475410201311
31.501481272030759
40.6301145017187071