.. only:: html
.. note::
:class: sphx-glr-download-link-note
Click :ref:`here ` to download the full example code
.. rst-class:: sphx-glr-example-title
.. _sphx_glr_auto_probabilistic_modeling_distributions_plot_conditional_random_vector.py:
Create a conditional random vector
==================================
In this example we are going to build a conditional random vector
.. math::
\underline{X}|\underline{\Theta}
.. code-block:: default
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)
.. code-block:: default
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
.. code-block:: default
XgivenThetaDist = ot.Exponential()
create the X distribution
.. code-block:: default
XDist = ot.ConditionalRandomVector(XgivenThetaDist, thetaRV)
draw a sample
.. code-block:: default
XDist.getSample(5)
.. raw:: html
| X0 |
0 | 1.812024 |
1 | 0.1309253 |
2 | 0.1192632 |
3 | 0.1325812 |
4 | 0.6158109 |
.. rst-class:: sphx-glr-timing
**Total running time of the script:** ( 0 minutes 0.001 seconds)
.. _sphx_glr_download_auto_probabilistic_modeling_distributions_plot_conditional_random_vector.py:
.. only :: html
.. container:: sphx-glr-footer
:class: sphx-glr-footer-example
.. container:: sphx-glr-download sphx-glr-download-python
:download:`Download Python source code: plot_conditional_random_vector.py `
.. container:: sphx-glr-download sphx-glr-download-jupyter
:download:`Download Jupyter notebook: plot_conditional_random_vector.ipynb `
.. only:: html
.. rst-class:: sphx-glr-signature
`Gallery generated by Sphinx-Gallery `_