.. 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_estimate_dependency_and_copulas_plot_kendallplot_test.py:
Copula fitting test using Kendall plot
======================================
In this example we are going to perform a visual goodness-of-fit test for a copula with the Kendall plot test.
.. 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 two samples
.. code-block:: default
N = 500
dist1 = ot.ComposedDistribution([ot.Normal()] * 2, ot.GumbelCopula(3.0))
sample1 = dist1.getSample(N)
sample1.setName('sample1')
dist2 = ot.ComposedDistribution([ot.Normal()] * 2, ot.ClaytonCopula(0.2))
sample2 = dist2.getSample(N)
sample2.setName('sample2')
Change the parameter for the evaluation of E(Wi)
.. code-block:: default
ot.ResourceMap.SetAsUnsignedInteger('VisualTest-KendallPlot-MonteCarloSize', 25)
Test a specific copula model for a given sample
.. code-block:: default
copula_test = ot.GumbelCopula(3)
graph = ot.VisualTest.DrawKendallPlot(sample1, copula_test)
view =viewer.View(graph)
.. image:: /auto_data_analysis/estimate_dependency_and_copulas/images/sphx_glr_plot_kendallplot_test_001.png
:alt: Kendall Plot
:class: sphx-glr-single-img
Test whether two samples have the same copula model
.. code-block:: default
graph = ot.VisualTest.DrawKendallPlot(sample1, sample2)
view = viewer.View(graph)
plt.show()
.. image:: /auto_data_analysis/estimate_dependency_and_copulas/images/sphx_glr_plot_kendallplot_test_002.png
:alt: Kendall Plot
:class: sphx-glr-single-img
.. rst-class:: sphx-glr-timing
**Total running time of the script:** ( 0 minutes 0.478 seconds)
.. _sphx_glr_download_auto_data_analysis_estimate_dependency_and_copulas_plot_kendallplot_test.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_kendallplot_test.py `
.. container:: sphx-glr-download sphx-glr-download-jupyter
:download:`Download Jupyter notebook: plot_kendallplot_test.ipynb `
.. only:: html
.. rst-class:: sphx-glr-signature
`Gallery generated by Sphinx-Gallery `_