.. 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_data_analysis_statistical_hypothesis_testing_plot_qqplot_graph.py:
Distribution fitting test using QQ plot
=======================================
In this example we are going to perform a visual goodness-of-fit test for an 1-d distribution with the QQ plot.
.. code-block:: default
from __future__ import print_function
import openturns as ot
import openturns.viewer as viewer
from matplotlib import pylab as plt
ot.Log.Show(ot.Log.NONE)
Create data
.. code-block:: default
ot.RandomGenerator.SetSeed(0)
distribution = ot.Gumbel(0.2, 0.5)
sample = distribution.getSample(100)
sample.setDescription(['Sample'])
Fit a distribution
.. code-block:: default
distribution = ot.GumbelFactory().build(sample)
Draw QQ plot
.. code-block:: default
graph = ot.VisualTest.DrawQQplot(sample, distribution)
view = viewer.View(graph)
.. image:: /auto_data_analysis/statistical_hypothesis_testing/images/sphx_glr_plot_qqplot_graph_001.png
:alt: Sample versus model QQ-plot
:class: sphx-glr-single-img
Incorrect proposition
.. code-block:: default
graph = ot.VisualTest.DrawQQplot(sample, ot.WeibullMin())
view = viewer.View(graph)
plt.show()
.. image:: /auto_data_analysis/statistical_hypothesis_testing/images/sphx_glr_plot_qqplot_graph_002.png
:alt: Sample versus model QQ-plot
:class: sphx-glr-single-img
.. rst-class:: sphx-glr-timing
**Total running time of the script:** ( 0 minutes 0.173 seconds)
.. _sphx_glr_download_auto_data_analysis_statistical_hypothesis_testing_plot_qqplot_graph.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_qqplot_graph.py `
.. container:: sphx-glr-download sphx-glr-download-jupyter
:download:`Download Jupyter notebook: plot_qqplot_graph.ipynb `
.. only:: html
.. rst-class:: sphx-glr-signature
`Gallery generated by Sphinx-Gallery `_