.. 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 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 =========================== .. 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-15 .. code-block:: default 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 16-17 Create data .. GENERATED FROM PYTHON SOURCE LINES 17-22 .. code-block:: default R = ot.CorrelationMatrix(2) R[1, 0] = 0.4 copula = ot.NormalCopula(R) sample = copula.getSample(30) .. GENERATED FROM PYTHON SOURCE LINES 23-24 Estimate a normal copula using BernsteinCopulaFactory .. GENERATED FROM PYTHON SOURCE LINES 24-26 .. code-block:: default distribution = ot.BernsteinCopulaFactory().build(sample) .. GENERATED FROM PYTHON SOURCE LINES 27-28 Draw fitted distribution .. GENERATED FROM PYTHON SOURCE LINES 28-31 .. code-block:: default 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 32-33 Estimate a normal copula using KernelSmoothing .. GENERATED FROM PYTHON SOURCE LINES 33-37 .. code-block:: default 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 .. rst-class:: sphx-glr-timing **Total running time of the script:** ( 0 minutes 0.344 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 `_