Create a stationary covariance modelΒΆ

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 \rho writes:

\rho(\vect{s}, \vect{t} ) = e^{-\left\| \vect{s}- \vect{t} \right\|_2} \quad \forall (\vect{s}, \vect{t}) \in \mathcal{D}

It is possible to define the exponential model from the spatial covariance matrix \mat{C}^{spat} rather than the correlation matrix \mat{R}:

\forall \vect{t} \in \mathcal{D},\quad \mat{C}^{spat} = \mathbb{E} \left[ X_{\vect{t}} X^t_{\vect{t}} \right]
= \mat{A}\,\mat{R}, \mat{A}

with:

\mat{A} = \mbox{Diag}(a_1, \dots, a_d)

We call \vect{a} the amplitude vector and \vect{\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 (\vect{\lambda}, \vect{a}): in that case, by default \mat{R} = \mat{I};

  • the scale and amplitude vectors and the spatial correlation matrix (\vect{\lambda}, \vect{a},\mat{R});

  • the scale and amplitude vectors and the spatial covariance matrix (\vect{\lambda}, \vect{a},\mat{C}); Then \mat{C} is mapped into the associated correlation matrix \mat{R} and the previous constructor is used.

import openturns as ot

ot.Log.Show(ot.Log.NONE)

Create the amplitude vector (output dimension 3)

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

Create the covariance model from the amplitude and scale, no spatial correlation

ot.ExponentialModel(scale, amplitude)
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


or from the amplitude, scale and spatial vorrelation

ot.ExponentialModel(scale, amplitude, spatialCorrelation)
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


or from the scale and spatial covariance

ot.ExponentialModel(scale, spatialCovariance)
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