Fit a non parametric copulaΒΆ

In this example we are going to estimate a normal copula from a sample using non parametric representations.

In [1]:
from __future__ import print_function
import openturns as ot
import matplotlib.pyplot as plt
In [2]:
# Create data
R = ot.CorrelationMatrix(2)
R[1, 0] = 0.4
copula = ot.NormalCopula(R)
sample = copula.getSample(30)
In [3]:
# Estimate a normal copula using BernsteinCopulaFactory
distribution = ot.BernsteinCopulaFactory().build(sample)
In [4]:
# Draw fitted distribution
distribution.drawPDF()
Out[4]:
../../_images/examples_data_analysis_estimate_non_parametric_copula_5_0.svg
In [5]:
# Estimate a normal copula using KernelSmoothing
distribution = ot.KernelSmoothing().build(sample).getCopula()
distribution.drawPDF()
Out[5]:
../../_images/examples_data_analysis_estimate_non_parametric_copula_6_0.svg