Note
Click here to download the full example code
Fit a parametric copulaΒΆ
In this example we are going to estimate the parameters of a gaussian copula from a sample.
import openturns as ot
import openturns.viewer as viewer
from matplotlib import pylab as plt
ot.Log.Show(ot.Log.NONE)
Create data
R = ot.CorrelationMatrix(2)
R[1, 0] = 0.4
copula = ot.NormalCopula(R)
sample = copula.getSample(500)
Estimate a normal copula
distribution = ot.NormalCopulaFactory().build(sample)
print(distribution)
Out:
NormalCopula(R = [[ 1 0.427237 ]
[ 0.427237 1 ]])
The estimated parameters
distribution.getParameter()
Draw fitted distribution
graph = distribution.drawPDF()
view = viewer.View(graph)
plt.show()
![[X0,X1] iso-PDF](../../_images/sphx_glr_plot_estimate_copula_001.png)
Total running time of the script: ( 0 minutes 0.111 seconds)