.. 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 7-11 Abstract -------- In this example we show how to define extreme values distributions. .. GENERATED FROM PYTHON SOURCE LINES 13-17 .. code-block:: Python import openturns as ot import openturns.viewer as otv from matplotlib import pyplot as plt .. GENERATED FROM PYTHON SOURCE LINES 18-20 The generalized extreme value distribution (GEV) ------------------------------------------------ .. GENERATED FROM PYTHON SOURCE LINES 22-27 The :class:`~openturns.GeneralizedExtremeValue` distribution is a family of continuous probability distributions that combines the :class:`~openturns.Gumbel`, :class:`~openturns.Frechet` and :class:`~openturns.WeibullMax` distributions, all extreme value distributions. 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 27-29 .. code-block:: Python myDistribution = ot.GeneralizedExtremeValue(0.0, 1.0, 0.0) .. GENERATED FROM PYTHON SOURCE LINES 30-31 The :class:`~openturns.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 31-33 .. 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 34-36 For the chosen parameters it is a Gumbel distribution with parameters :math:`\beta=1` and :math:`\gamma = 0`. .. GENERATED FROM PYTHON SOURCE LINES 38-39 We draw its PDF and CDF : .. GENERATED FROM PYTHON SOURCE LINES 39-51 .. 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.svg :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.svg :class: sphx-glr-multi-img * .. image-sg:: /auto_probabilistic_modeling/distributions/images/sphx_glr_plot_create_extreme_value_distribution_002.svg :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.svg :class: sphx-glr-multi-img .. GENERATED FROM PYTHON SOURCE LINES 52-58 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 58-60 .. code-block:: Python myGPD = ot.GeneralizedPareto(1.0, 0.0, 0.0) .. GENERATED FROM PYTHON SOURCE LINES 61-62 We draw its PDF and CDF : .. GENERATED FROM PYTHON SOURCE LINES 62-68 .. 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.svg :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.svg :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 69-75 .. 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.svg :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.svg :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 76-77 Display all figures .. GENERATED FROM PYTHON SOURCE LINES 77-78 .. 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 ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_create_extreme_value_distribution.zip `