.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_data_analysis/estimate_dependency_and_copulas/plot_estimate_non_parametric_copula.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` 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 =========================== .. GENERATED FROM PYTHON SOURCE LINES 7-8 In this example we are going to estimate a normal copula from a sample using non parametric representations. .. GENERATED FROM PYTHON SOURCE LINES 10-16 .. code-block:: Python import openturns as ot import openturns.viewer as viewer from matplotlib import pylab as plt ot.Log.Show(ot.Log.NONE) .. GENERATED FROM PYTHON SOURCE LINES 17-18 Create data .. GENERATED FROM PYTHON SOURCE LINES 18-23 .. code-block:: Python R = ot.CorrelationMatrix(2) R[1, 0] = 0.4 copula = ot.NormalCopula(R) sample = copula.getSample(30) .. GENERATED FROM PYTHON SOURCE LINES 24-25 Estimate a normal copula using BernsteinCopulaFactory .. GENERATED FROM PYTHON SOURCE LINES 25-27 .. code-block:: Python distribution = ot.BernsteinCopulaFactory().build(sample) .. GENERATED FROM PYTHON SOURCE LINES 28-29 Draw fitted distribution .. GENERATED FROM PYTHON SOURCE LINES 29-32 .. code-block:: Python graph = distribution.drawPDF() view = viewer.View(graph) .. image-sg:: /auto_data_analysis/estimate_dependency_and_copulas/images/sphx_glr_plot_estimate_non_parametric_copula_001.png :alt: [X0,X1] iso-PDF :srcset: /auto_data_analysis/estimate_dependency_and_copulas/images/sphx_glr_plot_estimate_non_parametric_copula_001.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 33-34 Estimate a normal copula using KernelSmoothing .. GENERATED FROM PYTHON SOURCE LINES 34-38 .. code-block:: Python distribution = ot.KernelSmoothing().build(sample).getCopula() graph = distribution.drawPDF() view = viewer.View(graph) plt.show() .. image-sg:: /auto_data_analysis/estimate_dependency_and_copulas/images/sphx_glr_plot_estimate_non_parametric_copula_002.png :alt: [X0,X1] iso-PDF :srcset: /auto_data_analysis/estimate_dependency_and_copulas/images/sphx_glr_plot_estimate_non_parametric_copula_002.png :class: sphx-glr-single-img .. _sphx_glr_download_auto_data_analysis_estimate_dependency_and_copulas_plot_estimate_non_parametric_copula.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_estimate_non_parametric_copula.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_estimate_non_parametric_copula.py `