Autocovariance (source code)

= Autocovariance
{title2=$\gamma(h)$}
{wiki}

= Autocovariance sequence
{synonym}

= Autocovariance function
{synonym}

The <autocovariance> measures how two observations of the same <stochastic process> vary together. For a real <weakly stationary process> of <mean> $\mu$, it is
$$
\gamma(h)=\operatorname{Cov}(X_{t+h},X_t)
=\mathbb E[(X_{t+h}-\mu)(X_t-\mu)].
$$
Weak stationarity removes dependence on the absolute time $t$. Without it, the <covariance function> generally needs two time arguments. Lag zero is the <variance>, $\gamma(0)=\operatorname{Var}(X_t)$; symmetry of real <covariance> gives $\gamma(-h)=\gamma(h)$. Positive values favor deviations from the <mean> in the same direction; negative values favor opposite directions. The units are the square of the observation units. See https://www.stat.berkeley.edu/~bartlett/courses/153-fall2010/lectures/2.pdf[Bartlett, lecture 2: autocovariance examples].

For example, if $X_t=\varepsilon_t+\tfrac12\varepsilon_{t-1}$ with centered unit-<variance> <white noise>, expanding the product leaves only matching noise times. Thus $\gamma(0)=1+1/4=5/4$, $\gamma(1)=1/2$, and $\gamma(h)=0$ for $|h|\ge2$. This <MA(1)> has a positive lag-one <autocovariance> because adjacent observations share one disturbance. Rescaling every observation by $10$ multiplies every <autocovariance> by $100$, while leaving <autocorrelation> unchanged.

The <autocovariance> is useful beyond comparing pairs: it determines the <variance> of any finite linear combination of observations. For the <sample mean> $\overline X_n$,
$$
\operatorname{Var}(\overline X_n)=\frac{1}{n^2}\left[n\gamma(0)+2\sum_{h=1}^{n-1}(n-h)\gamma(h)\right].
$$
Each separation $h$ occurs in $n-h$ pairs. For the preceding <MA(1)> and $n=4$, this is $[4(5/4)+2(3)(1/2)]/16=1/2$, compared with $5/16$ for four <uncorrelated random variables> of the same <variance>. This is the finite-record counterpart of the <long-run variance of a stationary process>.