Note
Click here to download the full example code
Create a conditional random vectorΒΆ
In this example we are going to build a conditional random vector
from __future__ import print_function
import openturns as ot
import openturns.viewer as viewer
from matplotlib import pylab as plt
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)
create the XgivenTheta distribution
XgivenThetaDist = ot.Exponential()
create the X distribution
XDist = ot.ConditionalRandomVector(XgivenThetaDist, thetaRV)
draw a sample
XDist.getSample(5)
X0 | |
---|---|
0 | 1.812024 |
1 | 0.1309253 |
2 | 0.1192632 |
3 | 0.1325812 |
4 | 0.6158109 |
Total running time of the script: ( 0 minutes 0.001 seconds)