# Variogram

In spatial statistics the theoretical variogram ${\displaystyle 2\gamma (\mathbf {s} _{1},\mathbf {s} _{2})}$ is a function describing the degree of spatial dependence of a spatial random field or stochastic process ${\displaystyle Z(\mathbf {s} )}$.

In the case of a concrete example from the field of gold mining, a variogram will give a measure of how much two samples taken from the mining area will vary in gold percentage depending on the distance between those samples. Samples taken far apart will vary more than samples taken close to each other.

Five types of variogram curves. At left, variogram curves depending on the distance between two points; at right, the corresponding simulated fields in space, constrained by these variograms.

## Definition

### Semivariogram

The semivariogram ${\displaystyle \gamma (h)}$ was first defined by Matheron (1963) as half the average squared difference between points (${\displaystyle \mathbf {s} _{1}}$ and ${\displaystyle \mathbf {s} _{2}}$) separated at distance ${\displaystyle h}$.[1][2] Formally

${\displaystyle \gamma (h)={\frac {1}{2V}}\iiint _{V}\left[f(M+h)-f(M)\right]^{2}dV,}$

where ${\displaystyle M}$ is a point in the geometric field ${\displaystyle V}$, and ${\displaystyle f(M)}$ is the value at that point. For example, suppose we are interested in iron content in soil samples in some region or field ${\displaystyle V}$. ${\displaystyle f(M)}$ would be the content (e.g., in mg iron per kg soil) of iron at some location ${\displaystyle M}$, where ${\displaystyle M}$ has coordinates of latitude, longitude, and depth. The triple integral is over 3 dimensions. ${\displaystyle \gamma (h)}$ is the separation distance (e.g., in m or km) of interest. To obtain the semivariogram for a given ${\displaystyle \gamma (h)}$, all pairs of points at that exact distance would be sampled. In practice it is impossible to sample everywhere, so the empirical variogram is used instead.

### Variogram

The variogram is defined as the variance of the difference between field values at two locations (${\displaystyle \mathbf {s} _{1}}$ and ${\displaystyle \mathbf {s} _{2}}$, note change of notation from ${\displaystyle M}$ to ${\displaystyle \mathbf {s} }$ and ${\displaystyle f}$ to ${\displaystyle Z}$) across realizations of the field (Cressie 1993):

${\displaystyle 2\gamma (\mathbf {s} _{1},s_{2})={\text{var}}\left(Z(\mathbf {s} _{1})-Z(\mathbf {s} _{2})\right)=E\left[((Z(\mathbf {s} _{1})-\mu (\mathbf {s} _{1}))-(Z(\mathbf {s} _{2})-\mu (\mathbf {s} _{2})))^{2}\right].}$

or in other words is twice the semivariogram. If the spatial random field has constant mean ${\displaystyle \mu }$, this is equivalent to the expectation for the squared increment of the values between locations ${\displaystyle \mathbf {s} _{1}}$ and ${\displaystyle s_{2}}$ (Wackernagel 2003) (where ${\displaystyle \mathbf {s} _{1}}$ and ${\displaystyle \mathbf {s} _{2}}$ are points in space and possibly time):

${\displaystyle 2\gamma (\mathbf {s} _{1},\mathbf {s} _{2})=E\left[\left(Z(\mathbf {s} _{1})-Z(\mathbf {s} _{2})\right)^{2}\right].}$

In the case of a stationary process, the variogram and semivariogram can be represented as a function ${\displaystyle \gamma _{s}(h)=\gamma (0,0+h)}$ of the difference ${\displaystyle h=\mathbf {s} _{2}-\mathbf {s} _{1}}$ between locations only, by the following relation (Cressie 1993):

${\displaystyle \gamma (\mathbf {s} _{1},\mathbf {s} _{2})=\gamma _{s}(\mathbf {s} _{2}-\mathbf {s} _{1}).}$

If the process is furthermore isotropic, then the variogram and semivariogram can be represented by a function ${\displaystyle \gamma _{i}(h):=\gamma _{s}(he_{1})}$ of the distance ${\displaystyle h=\|\mathbf {s} _{2}-\mathbf {s} _{1}\|}$ only (Cressie 1993):

${\displaystyle \gamma (\mathbf {s} _{1},\mathbf {s} _{2})=\gamma _{i}(h).}$

The indexes ${\displaystyle i}$ or ${\displaystyle s}$ are typically not written. The terms are used for all three forms of the function. Moreover, the term "variogram" is sometimes used to denote the semivariogram, and the symbol ${\displaystyle \gamma }$ is sometimes used for the variogram, which brings some confusion.

## Properties

According to (Cressie 1993, Chiles and Delfiner 1999, Wackernagel 2003) the theoretical variogram has the following properties:

• The semivariogram is nonnegative ${\displaystyle \gamma (\mathbf {s} _{1},\mathbf {s} _{2})\geq 0}$, since it is the expectation of a square.
• The semivariogram ${\displaystyle \gamma (\mathbf {s} _{1},\mathbf {s} _{1})=\gamma _{i}(0)=E\left((Z(\mathbf {s} _{1})-Z(\mathbf {s} _{1}))^{2}\right)=0}$ at distance 0 is always 0, since ${\displaystyle Z(\mathbf {s} _{1})-Z(\mathbf {s} _{1})=0}$.
• A function is a semivariogram if and only if it is a conditionally negative definite function, i.e. for all weights ${\displaystyle w_{1},\ldots ,w_{N}}$ subject to ${\displaystyle \sum _{i=1}^{N}w_{i}=0}$ and locations ${\displaystyle s_{1},\ldots ,s_{N}}$ it holds:

${\displaystyle \sum _{i=1}^{N}\sum _{j=1}^{N}w_{i}\gamma (\mathbf {s} _{i},\mathbf {s} _{j})w_{j}\leq 0}$

which corresponds to the fact that the variance ${\displaystyle var(X)}$ of ${\displaystyle X=\sum _{i=1}^{N}w_{i}Z(x_{i})}$ is given by the negative of this double sum and must be nonnegative.[citation needed]
• As a consequence the semivariogram might be non continuous only at the origin. The height of the jump at the origin is sometimes referred to as nugget or nugget effect.
• If the covariance function of a stationary process exists it is related to variogram by

${\displaystyle 2\gamma (\mathbf {s} _{1},\mathbf {s} _{2})=C(\mathbf {s} _{1},\mathbf {s} _{1})+C(\mathbf {s} _{2},\mathbf {s} _{2})-2C(\mathbf {s} _{1},\mathbf {s} _{2})}$

For a non-stationary process the square of the difference between expected values at both points must be added:

${\displaystyle 2\gamma (\mathbf {s} _{1},\mathbf {s} _{2})=C(\mathbf {s} _{1},\mathbf {s} _{1})+C(\mathbf {s} _{2},\mathbf {s} _{2})-2C(\mathbf {s} _{1},\mathbf {s} _{2})+(E\left[Z(\mathbf {s} _{1})\right]-E\left[Z(\mathbf {s} _{2})\right])^{2}}$

• If a stationary random field has no spatial dependence (i.e. ${\displaystyle C(h)=0}$ if ${\displaystyle h\not =0}$), the semivariogram is the constant ${\displaystyle var(Z(\mathbf {s} ))}$ everywhere except at the origin, where it is zero.
• ${\displaystyle \gamma (\mathbf {s} _{1},\mathbf {s} _{2})=E\left[|Z(\mathbf {s} _{1})-Z(\mathbf {s} _{2})|^{2}\right]=\gamma (\mathbf {s} _{2},\mathbf {s} _{1})}$ is a symmetric function.
• Consequently, ${\displaystyle \gamma _{s}(h)=\gamma _{s}(-h)}$ is an even function.
• If the random field is stationary and ergodic, the ${\displaystyle \lim _{h\to \infty }\gamma _{s}(h)=var(Z(\mathbf {s} ))}$ corresponds to the variance of the field. The limit of the semivariogram is also called its sill.

## Empirical variogram and application

Generally an empirical variogram is needed, because sample information ${\displaystyle Z}$ is not available for every location. The sample information could be concentration of iron in soil samples, or could be pixel intensity on a camera. Each piece of sample information has coordinates ${\displaystyle \mathbf {s} =(x,y)}$ for a 2D sample space where ${\displaystyle x}$ and ${\displaystyle y}$ are geographical coordinates. In the case of the iron in soil, the sample space could be 3 dimensional. If there is temporal variability as well (e.g., phosphorus content in a lake) then ${\displaystyle \mathbf {s} }$ could be a 4 dimensional vector ${\displaystyle (x,y,z,t)}$. For the case where dimensions have different units (e.g., distance and time) then a scaling factor ${\displaystyle B}$ can be applied to each to obtain a modified Euclidean distance.[3]

Sample observations are denoted ${\displaystyle Z(\mathbf {s} _{i})=z_{i}}$. Samples may be taken at ${\displaystyle k}$ total different locations. This would provide as set of samples ${\displaystyle z_{1},\ldots ,z_{k}}$ at locations ${\displaystyle \mathbf {s} _{1},\ldots ,\mathbf {s} _{k}}$. Generally plots show the semivariogram values a function of sample point separation ${\displaystyle h}$. In the case of empirical semivariogram, separation distance bins ${\displaystyle h\pm \delta }$ are used rather than exact distances, and usually isotropic conditions are assumed (i.e., that ${\displaystyle \gamma }$ is only a function of ${\displaystyle h}$ and does not depend on other variables such as center position). Then, the empirical semivariogram ${\displaystyle {\hat {\gamma }}(h\pm \delta )}$ can be calculated for each bin:

${\displaystyle {\hat {\gamma }}(h\pm \delta ):={\frac {1}{2|N(h\pm \delta )|}}\sum _{(i,j)\in N(h\pm \delta )}|z_{i}-z_{j}|^{2}}$

Or in other words, each pair of points separated by ${\displaystyle h}$ (plus or minus some bin width tolerance range ${\displaystyle \delta }$) are found. These form the set of points ${\displaystyle N(h\pm \delta )\equiv \{(\mathbf {s} _{i},\mathbf {s} _{j}):|\mathbf {s} _{i},\mathbf {s} _{j}|=h\pm \delta ;i,j=1,\ldots ,N\}}$. The number of these points in this bin is ${\displaystyle |N(h\pm \delta )|}$. Then for each pair of points ${\displaystyle i,j}$, the square of the difference in the observation (e.g., soil sample content or pixel intensity) is found (${\displaystyle |z_{i}-z_{j}|^{2}}$). These squared differences are added together and normalized by the natural number ${\displaystyle |N(h\pm \delta )|}$. By definition the result is divided by 2 for the semivariogram at this separation.

For computational speed, only the unique pairs of points are needed. For example, for 2 observations pairs [${\displaystyle (z_{a},z_{b}),(z_{c},z_{d})}$] taken from locations with separation ${\displaystyle h\pm \delta }$ only [${\displaystyle (z_{a},z_{b}),(z_{c},z_{d})}$] need to be considered, as the pairs [${\displaystyle (z_{b},z_{a}),(z_{d},z_{c})}$] do not provide any additional information.

The empirical variogram is used in geostatistics as a first estimate of the (theoretical) variogram needed for spatial interpolation by kriging.

According to (Cressie 1993), for observations ${\displaystyle z_{i}=Z(\mathbf {s} _{i})}$ from a stationary random field ${\displaystyle Z(\mathbf {s} )}$, the empirical variogram with lag tolerance 0 is an unbiased estimator of the theoretical semivariogram, due to:

${\displaystyle E\left[{\hat {\gamma }}(h)\right]={\frac {1}{2|N(h)|}}\sum _{(i,j)\in N(h)}E\left[|Z(s_{i})-Z(s_{j})|^{2}\right]={\frac {1}{2|N(h)|}}\sum _{(i,j)\in N(h)}2\gamma (s_{j}-s_{i})={\frac {2|N(h)|}{2|N(h)|}}\gamma (h)}$

## Variogram parameters

The following parameters are often used to describe variograms:

• nugget ${\displaystyle n}$: The height of the jump of the semivariogram at the discontinuity at the origin.
• sill ${\displaystyle s}$: Limit of the variogram tending to infinity lag distances.
• range ${\displaystyle r}$: The distance in which the difference of the variogram from the sill becomes negligible. In models with a fixed sill, it is the distance at which this is first reached; for models with an asymptotic sill, it is conventionally taken to be the distance when the semivariance first reaches 95% of the sill.

## Variogram models

The empirical variogram cannot be computed at every lag distance ${\displaystyle h}$ and due to variation in the estimation it is not ensured that it is a valid variogram, as defined above. However some Geostatistical methods such as kriging need valid semivariograms. In applied geostatistics the empirical variograms are thus often approximated by model function ensuring validity (Chiles&Delfiner 1999). Some important models are (Chiles&Delfiner 1999, Cressie 1993):

• The exponential variogram model
${\displaystyle \gamma (h)=(s-n)(1-\exp(-h/(ra)))+n1_{(0,\infty )}(h)}$
• The spherical variogram model
${\displaystyle \gamma (h)=(s-n)\left(\left({\frac {3h}{2r}}-{\frac {h^{3}}{2r^{3}}}\right)1_{(0,r)}(h)+1_{[r,\infty )}(h)\right)+n1_{(0,\infty )}(h)}$
• The Gaussian variogram model
${\displaystyle \gamma (h)=(s-n)\left(1-\exp \left(-{\frac {h^{2}}{r^{2}a}}\right)\right)+n1_{(0,\infty )}(h)}$

The parameter ${\displaystyle a}$ has different values in different references, due to the ambiguity in the definition of the range. E.g. ${\displaystyle a=1/3}$ is the value used in (Chiles&Delfiner 1999). The ${\displaystyle 1_{A}(h)}$ function is 1 if ${\displaystyle h\in A}$ and 0 otherwise.

## Discussion

Three functions are used in geostatistics for describing the spatial or the temporal correlation of observations: these are the correlogram, the covariance and the semivariogram. The last is also more simply called variogram. The sampling variogram, unlike the semivariogram and the variogram, shows where a significant degree of spatial dependence in the sample space or sampling unit dissipates into randomness when the variance terms of a temporally or in-situ ordered set are plotted against the variance of the set and the lower limits of its 99% and 95% confidence ranges.

The variogram is the key function in geostatistics as it will be used to fit a model of the temporal/spatial correlation of the observed phenomenon. One is thus making a distinction between the experimental variogram that is a visualisation of a possible spatial/temporal correlation and the variogram model that is further used to define the weights of the kriging function. Note that the experimental variogram is an empirical estimate of the covariance of a Gaussian process. As such, it may not be positive definite and hence not directly usable in kriging, without constraints or further processing. This explains why only a limited number of variogram models are used: most commonly, the linear, the spherical, the Gaussian and the exponential models.

## Related concepts

The squared term in the variogram, for instance ${\displaystyle (Z(\mathbf {s} _{1})-Z(\mathbf {s} _{2}))^{2}}$, can be replaced with different powers: A madogram is defined with the absolute difference, ${\displaystyle |Z(\mathbf {s} _{1})-Z(\mathbf {s} _{2})|}$, and a rodogram is defined with the square root of the absolute difference, ${\displaystyle |Z(\mathbf {s} _{1})-Z(\mathbf {s} _{2})|^{0.5}}$. Estimators based on these lower powers are said to be more resistant to outliers. They can be generalized as a "variogram of order α",

${\displaystyle 2\gamma (\mathbf {s} _{1},\mathbf {s} _{2})=E\left[\left|Z(\mathbf {s} _{1})-Z(\mathbf {s} _{2})\right|^{\alpha }\right]}$,

in which a variogram is of order 2, a madogram is a variogram of order 1, and a rodogram is a variogram of order 0.5.[4]

When a variogram is used to describe the correlation of different variables it is called cross-variogram. Cross-variograms are used in co-kriging. Should the variable be binary or represent classes of values, one is then talking about indicator variograms. Indicator variogram is used in indicator kriging.