.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_probabilistic_modeling/distributions/plot_create_extreme_value_distribution.py" .. LINE NUMBERS ARE GIVEN BELOW. .. 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_create_extreme_value_distribution.py: Create an extreme value distribution ==================================== .. GENERATED FROM PYTHON SOURCE LINES 6-10 Abstract -------- In this example we show how to define extreme values distributions. .. GENERATED FROM PYTHON SOURCE LINES 12-18 .. code-block:: default import openturns as ot import openturns.viewer as otv from matplotlib import pylab as plt ot.Log.Show(ot.Log.NONE) .. GENERATED FROM PYTHON SOURCE LINES 19-21 The generalized extreme value distribution (GEV) ------------------------------------------------ .. GENERATED FROM PYTHON SOURCE LINES 23-26 The :class:`~openturns.GeneralizedExtremeValue` distribution is a family of continuous probability distributions that combine the :class:`~openturns.Gumbel`, :class:`~openturns.Frechet` and :class:`~openturns.WeibullMax` distribution, all extreme value distribution. We define a generalized extreme value distribution with parameters :math:`\mu = 0.0`, :math:`\sigma = 1.0` and :math:`\xi = 0.0` .. GENERATED FROM PYTHON SOURCE LINES 26-28 .. code-block:: default myDistribution = ot.GeneralizedExtremeValue(0.0, 1.0, 0.0) .. GENERATED FROM PYTHON SOURCE LINES 29-30 The `GeneralizedExtremeValue` class acts as a proxy class. We can get the actual distribution (Weibull, Frechet or Gumbel) with the `getActualDistribution` method : .. GENERATED FROM PYTHON SOURCE LINES 30-32 .. code-block:: default print(myDistribution.getActualDistribution()) .. rst-class:: sphx-glr-script-out Out: .. code-block:: none Gumbel(beta = 1, gamma = 0) .. GENERATED FROM PYTHON SOURCE LINES 33-35 For the chosen parameters it is a Gumbel distribution with parameters :math:`beta=1.0` and :math:`\gamma = 0.0`. .. GENERATED FROM PYTHON SOURCE LINES 37-38 We draw its PDF and CDF : .. GENERATED FROM PYTHON SOURCE LINES 38-48 .. code-block:: default graphPDF = myDistribution.drawPDF() graphPDF.setTitle( r"PDF of the GEV with parameters $\mu = 0.0$, $\sigma = 1.0$ and $\xi = 0.0$ ") view = otv.View(graphPDF) graphCDF = myDistribution.drawCDF() graphCDF.setTitle( r"CDF of the GEV with parameters $\mu = 0.0$, $\sigma = 1.0$ and $\xi = 0.0$ ") view = otv.View(graphCDF) .. rst-class:: sphx-glr-horizontal * .. image-sg:: /auto_probabilistic_modeling/distributions/images/sphx_glr_plot_create_extreme_value_distribution_001.png :alt: PDF of the GEV with parameters $\mu = 0.0$, $\sigma = 1.0$ and $\xi = 0.0$ :srcset: /auto_probabilistic_modeling/distributions/images/sphx_glr_plot_create_extreme_value_distribution_001.png :class: sphx-glr-multi-img * .. image-sg:: /auto_probabilistic_modeling/distributions/images/sphx_glr_plot_create_extreme_value_distribution_002.png :alt: CDF of the GEV with parameters $\mu = 0.0$, $\sigma = 1.0$ and $\xi = 0.0$ :srcset: /auto_probabilistic_modeling/distributions/images/sphx_glr_plot_create_extreme_value_distribution_002.png :class: sphx-glr-multi-img .. GENERATED FROM PYTHON SOURCE LINES 49-55 The Generalized Pareto Distribution (GPD) ----------------------------------------- In this paragraph we turn to the definition of a :class:`~openturns.GeneralizedPareto` distribution. For instance we build a generalized Pareto distribution with parameters :math:`\sigma = 1.0`, :math:`\xi = 0.0` and :math:`u = 0.0` : .. GENERATED FROM PYTHON SOURCE LINES 55-57 .. code-block:: default myGPD = ot.GeneralizedPareto(1.0, 0.0, 0.0) .. GENERATED FROM PYTHON SOURCE LINES 58-59 We draw its PDF and CDF : .. GENERATED FROM PYTHON SOURCE LINES 59-64 .. code-block:: default graphPDF = myGPD.drawPDF() graphPDF.setTitle( r"PDF of the GPD with parameters $\sigma = 1.0$, $\xi = 0.0$ and $u = 0.0$ ") view = otv.View(graphPDF) .. image-sg:: /auto_probabilistic_modeling/distributions/images/sphx_glr_plot_create_extreme_value_distribution_003.png :alt: PDF of the GPD with parameters $\sigma = 1.0$, $\xi = 0.0$ and $u = 0.0$ :srcset: /auto_probabilistic_modeling/distributions/images/sphx_glr_plot_create_extreme_value_distribution_003.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 65-70 .. code-block:: default graphCDF = myGPD.drawCDF() graphCDF.setTitle( r"CDF of the GPD with parameters $\sigma = 1.0$, $\xi = 0.0$ and $u = 0.0$ ") view = otv.View(graphCDF) .. image-sg:: /auto_probabilistic_modeling/distributions/images/sphx_glr_plot_create_extreme_value_distribution_004.png :alt: CDF of the GPD with parameters $\sigma = 1.0$, $\xi = 0.0$ and $u = 0.0$ :srcset: /auto_probabilistic_modeling/distributions/images/sphx_glr_plot_create_extreme_value_distribution_004.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 71-72 Display all figures .. GENERATED FROM PYTHON SOURCE LINES 72-73 .. code-block:: default plt.show() .. rst-class:: sphx-glr-timing **Total running time of the script:** ( 0 minutes 0.307 seconds) .. _sphx_glr_download_auto_probabilistic_modeling_distributions_plot_create_extreme_value_distribution.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_create_extreme_value_distribution.py ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_create_extreme_value_distribution.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_