Fit a non parametric copulaΒΆ
In this example we are going to estimate a normal copula from a sample using non parametric representations.
[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(30)
[3]:
# Estimate a normal copula using BernsteinCopulaFactory
distribution = ot.BernsteinCopulaFactory().build(sample)
[4]:
# Draw fitted distribution
distribution.drawPDF()
[4]:
[5]:
# Estimate a normal copula using KernelSmoothing
distribution = ot.KernelSmoothing().build(sample).getCopula()
distribution.drawPDF()
[5]: