.. only:: html .. note:: :class: sphx-glr-download-link-note Click :ref:`here ` to download the full example code .. rst-class:: sphx-glr-example-title .. _sphx_glr_auto_data_analysis_estimate_dependency_and_copulas_plot_estimate_non_parametric_copula.py: Fit a non parametric copula =========================== In this example we are going to estimate a normal copula from a sample using non parametric representations. .. code-block:: default from __future__ import print_function import openturns as ot import openturns.viewer as viewer from matplotlib import pylab as plt ot.Log.Show(ot.Log.NONE) Create data .. code-block:: default R = ot.CorrelationMatrix(2) R[1, 0] = 0.4 copula = ot.NormalCopula(R) sample = copula.getSample(30) Estimate a normal copula using BernsteinCopulaFactory .. code-block:: default distribution = ot.BernsteinCopulaFactory().build(sample) Draw fitted distribution .. code-block:: default graph = distribution.drawPDF() view = viewer.View(graph) .. image:: /auto_data_analysis/estimate_dependency_and_copulas/images/sphx_glr_plot_estimate_non_parametric_copula_001.png :alt: [X0,X1] iso-PDF :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out Out: .. code-block:: none /home/devel/project/build/python/src/site-packages/openturns/viewer.py:432: UserWarning: No contour levels were found within the data range. contourset = self._ax[0].contour(X, Y, Z, **contour_kw) Estimate a normal copula using KernelSmoothing .. code-block:: default distribution = ot.KernelSmoothing().build(sample).getCopula() graph = distribution.drawPDF() view = viewer.View(graph) plt.show() .. image:: /auto_data_analysis/estimate_dependency_and_copulas/images/sphx_glr_plot_estimate_non_parametric_copula_002.png :alt: [X0,X1] iso-PDF :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** ( 0 minutes 0.231 seconds) .. _sphx_glr_download_auto_data_analysis_estimate_dependency_and_copulas_plot_estimate_non_parametric_copula.py: .. only :: html .. container:: sphx-glr-footer :class: sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_estimate_non_parametric_copula.py ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_estimate_non_parametric_copula.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_