.. 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 :ref:`Go to the end ` 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-19 .. code-block:: Python 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 20-22 The generalized extreme value distribution (GEV) ------------------------------------------------ .. GENERATED FROM PYTHON SOURCE LINES 24-29 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 29-31 .. code-block:: Python myDistribution = ot.GeneralizedExtremeValue(0.0, 1.0, 0.0) .. GENERATED FROM PYTHON SOURCE LINES 32-33 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 33-35 .. code-block:: Python print(myDistribution.getActualDistribution()) .. rst-class:: sphx-glr-script-out .. code-block:: none Gumbel(beta = 1, gamma = 0) .. GENERATED FROM PYTHON SOURCE LINES 36-38 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 40-41 We draw its PDF and CDF : .. GENERATED FROM PYTHON SOURCE LINES 41-53 .. code-block:: Python 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 54-60 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 60-62 .. code-block:: Python myGPD = ot.GeneralizedPareto(1.0, 0.0, 0.0) .. GENERATED FROM PYTHON SOURCE LINES 63-64 We draw its PDF and CDF : .. GENERATED FROM PYTHON SOURCE LINES 64-70 .. code-block:: Python 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 71-77 .. code-block:: Python 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 78-79 Display all figures .. GENERATED FROM PYTHON SOURCE LINES 79-80 .. code-block:: Python plt.show() .. _sphx_glr_download_auto_probabilistic_modeling_distributions_plot_create_extreme_value_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_create_extreme_value_distribution.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_create_extreme_value_distribution.py `