.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_probabilistic_modeling/distributions/plot_deconditioned_distribution.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_auto_probabilistic_modeling_distributions_plot_deconditioned_distribution.py: Create a deconditioned distribution =================================== .. GENERATED FROM PYTHON SOURCE LINES 7-35 In this example we are going to build the distribution of the random vector :math:`\inputRV` defined by the conditional distribution of: .. math:: \inputRV|\vect{\Theta} where :math:`\vect{\Theta}` is the output of the random variable :math:`\vect{Y}` through the link function :math:`f`: .. math:: \vect{\Theta} & = f(\vect{Y})\\ \vect{Y} & \sim \cL_{\vect{Y}} This example creates a :class:`~openturns.DeconditionedDistribution` which offers all the methods attached to the distributions. We consider the case where :math:`X` is of dimension 1 and follows a uniform distribution defined by: =============== ========================================================= =============================== Variable Distribution Parameter =============== ========================================================= =============================== :math:`X` :class:`~openturns.Uniform` (:math:`a, b`) :math:`(a,b) = (Y, 1+Y^2)` :math:`Y` :class:`~openturns.Uniform` (:math:`c, d`) :math:`(c,d) = (-1, 1)` =============== ========================================================= =============================== .. GENERATED FROM PYTHON SOURCE LINES 37-40 .. code-block:: Python import openturns as ot import openturns.viewer as otv .. GENERATED FROM PYTHON SOURCE LINES 41-42 Create the :math:`Y` distribution. .. GENERATED FROM PYTHON SOURCE LINES 42-44 .. code-block:: Python YDist = ot.Uniform(-1.0, 1.0) .. GENERATED FROM PYTHON SOURCE LINES 45-46 Create the link function :math:`f: y \rightarrow (y, 1+y^2)`. .. GENERATED FROM PYTHON SOURCE LINES 46-48 .. code-block:: Python f = ot.SymbolicFunction(["y"], ["y", "1+y^2"]) .. GENERATED FROM PYTHON SOURCE LINES 49-51 Create the conditional distribution of :math:`\vect{X}|\vect{\Theta}`: as the parameters have no importance, we use the default distribution. .. GENERATED FROM PYTHON SOURCE LINES 51-53 .. code-block:: Python XgivenThetaDist = ot.Uniform() .. GENERATED FROM PYTHON SOURCE LINES 54-55 Create the deconditioned distribution of :math:`X`. .. GENERATED FROM PYTHON SOURCE LINES 55-59 .. code-block:: Python XDist = ot.DeconditionedDistribution(XgivenThetaDist, YDist, f) XDist.setDescription([r"$X|\mathbf{\boldsymbol{\Theta}} = f(Y)$"]) XDist .. raw:: html
DeconditionedDistribution


.. GENERATED FROM PYTHON SOURCE LINES 60-61 Get a sample: .. GENERATED FROM PYTHON SOURCE LINES 61-63 .. code-block:: Python XDist.getSample(5) .. raw:: html
$X|\mathbf{\boldsymbol{\Theta}} = f(Y)$
00.9728113
1-0.655941
21.050775
31.277257
4-0.101663


.. GENERATED FROM PYTHON SOURCE LINES 64-65 Draw the PDF. .. GENERATED FROM PYTHON SOURCE LINES 65-69 .. code-block:: Python graph = XDist.drawPDF() view = otv.View(graph) .. image-sg:: /auto_probabilistic_modeling/distributions/images/sphx_glr_plot_deconditioned_distribution_001.svg :alt: plot deconditioned distribution :srcset: /auto_probabilistic_modeling/distributions/images/sphx_glr_plot_deconditioned_distribution_001.svg :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 70-71 .. code-block:: Python view.ShowAll() .. _sphx_glr_download_auto_probabilistic_modeling_distributions_plot_deconditioned_distribution.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_deconditioned_distribution.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_deconditioned_distribution.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_deconditioned_distribution.zip `