# Covariance function

> Mediated Wiki article. Canonical URL: https://mediated.wiki/source/Covariance_function
> Markdown URL: https://mediated.wiki/source/Covariance_function.md
> Source: https://en.wikipedia.org/wiki/Covariance_function
> Source revision: 1228878632
> License: Creative Commons Attribution-ShareAlike 4.0 International (https://creativecommons.org/licenses/by-sa/4.0/)

Function in probability theory

In [probability theory](/source/Probability_theory) and [statistics](/source/Statistics), the **covariance function** describes how much two [random variables](/source/Random_variable) change together (their *[covariance](/source/Covariance)*) with varying spatial or temporal separation. For a [random field](/source/Random_field) or [stochastic process](/source/Stochastic_process) *Z*(*x*) on a domain *D*, a covariance function *C*(*x*, *y*) gives the covariance of the values of the random field at the two locations *x* and *y*:

C ( x , y ) := cov ⁡ ( Z ( x ) , Z ( y ) ) = E [ ( Z ( x ) − E [ Z ( x ) ] ) ( Z ( y ) − E [ Z ( y ) ] ) ] . {\displaystyle C(x,y):=\operatorname {cov} (Z(x),Z(y))=\mathbb {E} {\Big [}{\big (}Z(x)-\mathbb {E} [Z(x)]{\big )}{\big (}Z(y)-\mathbb {E} [Z(y)]{\big )}{\Big ]}.\,}

The same *C*(*x*, *y*) is called the [autocovariance](/source/Autocovariance) function in two instances: in [time series](/source/Time_series) (to denote exactly the same concept except that *x* and *y* refer to locations in time rather than in space), and in multivariate random fields (to refer to the covariance of a variable with itself, as opposed to the [cross covariance](/source/Cross_covariance) between two different variables at different locations, Cov(*Z*(*x*1), *Y*(*x*2))).[1]

## Admissibility

For locations *x*1, *x*2, ..., *x**N* ∈ *D* the variance of every linear combination

- X = ∑ i = 1 N w i Z ( x i ) {\displaystyle X=\sum _{i=1}^{N}w_{i}Z(x_{i})}

can be computed as

- var ⁡ ( X ) = ∑ i = 1 N ∑ j = 1 N w i C ( x i , x j ) w j . {\displaystyle \operatorname {var} (X)=\sum _{i=1}^{N}\sum _{j=1}^{N}w_{i}C(x_{i},x_{j})w_{j}.}

A function is a valid covariance function if and only if[2] this variance is non-negative for all possible choices of *N* and weights *w*1, ..., *w**N*. A function with this property is called [positive semidefinite](/source/Positive-definite_kernel).

## Simplifications with stationarity

In case of a weakly [stationary](/source/Stationary_process) [random field](/source/Random_field), where

- C ( x i , x j ) = C ( x i + h , x j + h ) {\displaystyle C(x_{i},x_{j})=C(x_{i}+h,x_{j}+h)\,}

for any lag *h*, the covariance function can be represented by a one-parameter function

- C s ( h ) = C ( 0 , h ) = C ( x , x + h ) {\displaystyle C_{s}(h)=C(0,h)=C(x,x+h)\,}

which is called a *covariogram* and also a *covariance function*. Implicitly the *C*(*x**i*, *x**j*) can be computed from *C**s*(*h*) by:

- C ( x , y ) = C s ( y − x ) . {\displaystyle C(x,y)=C_{s}(y-x).\,}

The [positive definiteness](/source/Positive-definite_function) of this single-argument version of the covariance function can be checked by [Bochner's theorem](/source/Bochner's_theorem).[2]

## Parametric families of covariance functions

For a given [variance](/source/Variance) σ 2 {\displaystyle \sigma ^{2}} , a simple stationary parametric covariance function is the "exponential covariance function"

- C ( d ) = σ 2 exp ⁡ ( − d / V ) {\displaystyle C(d)=\sigma ^{2}\exp(-d/V)}

where *V* is a scaling parameter (correlation length), and *d* = *d*(*x*,*y*) is the distance between two points. Sample paths of a [Gaussian process](/source/Gaussian_process) with the exponential covariance function are not smooth. The "squared exponential" (or "[Gaussian](/source/Gaussian_function)") covariance function:

- C ( d ) = σ 2 exp ⁡ ( − ( d / V ) 2 ) {\displaystyle C(d)=\sigma ^{2}\exp(-(d/V)^{2})}

is a stationary covariance function with smooth sample paths.

The [Matérn covariance function](/source/Mat%C3%A9rn_covariance_function) and [rational quadratic covariance function](/source/Rational_quadratic_covariance_function) are two parametric families of stationary covariance functions. The Matérn family includes the exponential and squared exponential covariance functions as special cases.

## See also

- [Autocorrelation function](/source/Autocorrelation_function)

- [Correlation function](/source/Correlation_function)

- [Covariance matrix](/source/Covariance_matrix)

- [Covariance operator](/source/Covariance_operator) – Operator in probability theory

- [Kriging](/source/Kriging)

- [Positive-definite kernel](/source/Positive-definite_kernel)

- [Random field](/source/Random_field)

- [Stochastic process](/source/Stochastic_process)

- [Variogram](/source/Variogram)

## References

1. **[^](#cite_ref-1)** Wackernagel, Hans (2003). *Multivariate Geostatistics*. Springer.

1. ^ [***a***](#cite_ref-Cressie_2-0) [***b***](#cite_ref-Cressie_2-1) Cressie, Noel A.C. (1993). *Statistics for Spatial Data*. Wiley-Interscience.

---
Adapted from the Wikipedia article [Covariance function](https://en.wikipedia.org/wiki/Covariance_function) by Wikipedia contributors ([contributor history](https://en.wikipedia.org/wiki/Covariance_function?action=history)). Available under [Creative Commons Attribution-ShareAlike 4.0 International](https://creativecommons.org/licenses/by-sa/4.0/). Changes may have been made.
