.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_probabilistic_modeling/stochastic_processes/plot_create_stationary_covmodel.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_probabilistic_modeling_stochastic_processes_plot_create_stationary_covmodel.py: Create a stationary covariance model ==================================== .. GENERATED FROM PYTHON SOURCE LINES 6-34 This use case illustrates how the User can create a covariance function from parametric models. The library implements the *multivariate Exponential model* as a parametric model for the covariance function where the spatial covariance function :math:`\rho` writes: .. math:: \rho(\underline{s}, \underline{t} ) = e^{-\left\| \underline{s}- \underline{t} \right\|_2} \quad \forall (\underline{s}, \underline{t}) \in \mathcal{D} It is possible to define the exponential model from the spatial covariance matrix :math:`\underline{\underline{C}}^{spat}` rather than the correlation matrix :math:`\underline{\underline{R}}`: .. math:: \forall \underline{t} \in \mathcal{D},\quad \underline{\underline{C}}^{spat} = \mathbb{E} \left[ X_{\underline{t}} X^t_{\underline{t}} \right] = \underline{\underline{A}}\,\underline{\underline{R}}\, \underline{\underline{A}} with: .. math:: \underline{\underline{A}} = \mbox{Diag}(a_1, \dots, a_d) We call :math:`\underline{a}` the amplitude vector and :math:`\underline{\lambda}` the scale vector. The library implements the multivariate exponential model thanks to the object *ExponentialModel* which is created from: - the scale and amplitude vectors :math:`(\underline{\lambda}, \underline{a})`: in that case, by default :math:`\underline{\underline{R}} = \underline{\underline{I}}`; - the scale and amplitude vectors and the spatial correlation matrix :math:`(\underline{\lambda}, \underline{a},\underline{\underline{R}})`; - the scale and amplitude vectors and the spatial covariance matrix :math:`(\underline{\lambda}, \underline{a},\underline{\underline{C}})`; Then :math:`\underline{\underline{C}}` is mapped into the associated correlation matrix :math:`\underline{\underline{R}}` and the previous constructor is used. .. GENERATED FROM PYTHON SOURCE LINES 36-40 .. code-block:: Python import openturns as ot ot.Log.Show(ot.Log.NONE) .. GENERATED FROM PYTHON SOURCE LINES 41-42 Create the amplitude vector (output dimension 3) .. GENERATED FROM PYTHON SOURCE LINES 42-62 .. code-block:: Python amplitude = [1.0, 2.0, 3.0] # Scale vector (input dimension 1) scale = [4.0] # spatialCorrelation spatialCorrelation = ot.CorrelationMatrix(3) spatialCorrelation[0, 1] = 0.8 spatialCorrelation[0, 2] = 0.6 spatialCorrelation[1, 2] = 0.1 # spatialCovariance spatialCovariance = ot.CovarianceMatrix(3) spatialCovariance[0, 0] = 4.0 spatialCovariance[1, 1] = 5.0 spatialCovariance[2, 2] = 6.0 spatialCovariance[0, 1] = 1.2 spatialCovariance[0, 2] = 0.9 spatialCovariance[1, 2] = -0.2 .. GENERATED FROM PYTHON SOURCE LINES 63-64 Create the covariance model from the amplitude and scale, no spatial correlation .. GENERATED FROM PYTHON SOURCE LINES 64-66 .. code-block:: Python ot.ExponentialModel(scale, amplitude) .. raw:: html
class=ExponentialModel scale=class=Point name=Unnamed dimension=1 values=[4] amplitude=class=Point name=Unnamed dimension=3 values=[1,2,3] spatial correlation=class=CorrelationMatrix dimension=3 implementation=class=MatrixImplementation name=Unnamed rows=3 columns=3 values=[1,0,0,0,1,0,0,0,1] isDiagonal=true


.. GENERATED FROM PYTHON SOURCE LINES 67-68 or from the amplitude, scale and spatialCovariance .. GENERATED FROM PYTHON SOURCE LINES 68-70 .. code-block:: Python ot.ExponentialModel(scale, amplitude, spatialCorrelation) .. raw:: html
class=ExponentialModel scale=class=Point name=Unnamed dimension=1 values=[4] amplitude=class=Point name=Unnamed dimension=3 values=[1,2,3] spatial correlation=class=CorrelationMatrix dimension=3 implementation=class=MatrixImplementation name=Unnamed rows=3 columns=3 values=[1,0.8,0.6,0.8,1,0.1,0.6,0.1,1] isDiagonal=false


.. GENERATED FROM PYTHON SOURCE LINES 71-72 or from the scale and spatialCovariance .. GENERATED FROM PYTHON SOURCE LINES 72-73 .. code-block:: Python ot.ExponentialModel(scale, spatialCovariance) .. raw:: html
class=ExponentialModel scale=class=Point name=Unnamed dimension=1 values=[4] amplitude=class=Point name=Unnamed dimension=3 values=[2,2.23607,2.44949] spatial correlation=class=CorrelationMatrix dimension=3 implementation=class=MatrixImplementation name=Unnamed rows=3 columns=3 values=[1,0.268328,0.183712,0.268328,1,-0.0365148,0.183712,-0.0365148,1] isDiagonal=false


.. _sphx_glr_download_auto_probabilistic_modeling_stochastic_processes_plot_create_stationary_covmodel.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_create_stationary_covmodel.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_create_stationary_covmodel.py `