Fit a parametric copulaΒΆ

In this example we are going to estimate the parameters of a gaussian copula from a sample.

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(500)
In [3]:
# Estimate a normal copula
distribution = ot.NormalCopulaFactory().build(sample)
print(distribution)
NormalCopula(R = [[ 1        0.428625 ]
 [ 0.428625 1        ]])
In [5]:
# The estimated parameters
distribution.getParameter()
[0.428625]
In [4]:
# Draw fitted distribution
distribution.drawPDF()
Out[4]:
../../_images/examples_data_analysis_estimate_copula_6_0.svg