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.

In [1]:
from __future__ import print_function
import openturns as ot
In [2]:
# Create two samples
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')
In [3]:
# Change the parameter for the evaluation of E(Wi)
ot.ResourceMap.SetAsUnsignedInteger('VisualTest-KendallPlot-MonteCarloSize', 25)
In [4]:
# Test a specific copula model for a given sample
copula_test = ot.GumbelCopula(3)
ot.VisualTest.DrawKendallPlot(sample1, copula_test)
Out[4]:
../../_images/examples_data_analysis_kendallplot_test_5_0.svg
In [5]:
# Test whether two samples have the same copula model
ot.VisualTest.DrawKendallPlot(sample1, sample2)
Out[5]:
../../_images/examples_data_analysis_kendallplot_test_6_0.svg