Fit a parametric copulaΒΆ
In this example we are going to estimate the parameters of a gaussian copula from a sample.
[1]:
from __future__ import print_function
import openturns as ot
import matplotlib.pyplot as plt
[2]:
# Create data
R = ot.CorrelationMatrix(2)
R[1, 0] = 0.4
copula = ot.NormalCopula(R)
sample = copula.getSample(500)
[3]:
# Estimate a normal copula
distribution = ot.NormalCopulaFactory().build(sample)
print(distribution)
NormalCopula(R = [[ 1 0.428625 ]
[ 0.428625 1 ]])
[5]:
# The estimated parameters
distribution.getParameter()
[0.428625]
[4]:
# Draw fitted distribution
distribution.drawPDF()
[4]: