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)

dist2 = ot.ComposedDistribution([ot.Normal()] * 2, ot.ClaytonCopula(0.2))
sample2 = dist2.getSample(N)
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)
In [5]:
# Test whether two samples have the same copula model
ot.VisualTest.DrawKendallPlot(sample1, sample2)