Autocorrelation Explained

Autocorrelation, sometimes known as serial correlation in the discrete time case, is the correlation of a signal with a delayed copy of itself as a function of delay. Informally, it is the similarity between observations of a random variable as a function of the time lag between them. The analysis of autocorrelation is a mathematical tool for finding repeating patterns, such as the presence of a periodic signal obscured by noise, or identifying the missing fundamental frequency in a signal implied by its harmonic frequencies. It is often used in signal processing for analyzing functions or series of values, such as time domain signals.

Different fields of study define autocorrelation differently, and not all of these definitions are equivalent. In some fields, the term is used interchangeably with autocovariance.

Unit root processes, trend-stationary processes, autoregressive processes, and moving average processes are specific forms of processes with autocorrelation.

Auto-correlation of stochastic processes

In statistics, the autocorrelation of a real or complex random process is the Pearson correlation between values of the process at different times, as a function of the two times or of the time lag. Let

\left\{Xt\right\}

be a random process, and

t

be any point in time (

t

may be an integer for a discrete-time process or a real number for a continuous-time process). Then

Xt

is the value (or realization) produced by a given run of the process at time

t

. Suppose that the process has mean

\mut

and variance
2
\sigma
t
at time

t

, for each

t

. Then the definition of the auto-correlation function between times

t1

and

t2

is[1] [2]

where

\operatorname{E}

is the expected value operator and the bar represents complex conjugation. Note that the expectation may not be well defined.

Subtracting the mean before multiplication yields the auto-covariance function between times

t1

and

t2

:[1] [2]

Note that this expression is not well defined for all time series or processes, because the mean may not exist, or the variance may be zero (for a constant process) or infinite (for processes with distribution lacking well-behaved moments, such as certain types of power law).

Definition for wide-sense stationary stochastic process

If

\left\{Xt\right\}

is a wide-sense stationary process then the mean

\mu

and the variance

\sigma2

are time-independent, and further the autocovariance function depends only on the lag between

t1

and

t2

: the autocovariance depends only on the time-distance between the pair of values but not on their position in time. This further implies that the autocovariance and auto-correlation can be expressed as a function of the time-lag, and that this would be an even function of the lag

\tau=t2-t1

. This gives the more familiar forms for the auto-correlation function[1]

and the auto-covariance function:

In particular, note that

\operatorname_(0) = \sigma^2 .

Normalization

It is common practice in some disciplines (e.g. statistics and time series analysis) to normalize the autocovariance function to get a time-dependent Pearson correlation coefficient. However, in other disciplines (e.g. engineering) the normalization is usually dropped and the terms "autocorrelation" and "autocovariance" are used interchangeably.

The definition of the auto-correlation coefficient of a stochastic process is[2]

\rho_(t_1,t_2) = \frac = \frac .

If the function

\rhoXX

is well defined, its value must lie in the range

[-1,1]

, with 1 indicating perfect correlation and −1 indicating perfect anti-correlation.

For a wide-sense stationary (WSS) process, the definition is

\rho_(\tau) = \frac = \frac.

The normalization is important both because the interpretation of the autocorrelation as a correlation provides a scale-free measure of the strength of statistical dependence, and because the normalization has an effect on the statistical properties of the estimated autocorrelations.

Properties

Symmetry property

The fact that the auto-correlation function

\operatorname{R}XX

is an even function can be stated as[2] \operatorname_(t_1,t_2) = \overlinerespectively for a WSS process:[2] \operatorname_(\tau) = \overline .

Maximum at zero

For a WSS process:[2] \left|\operatorname_(\tau)\right| \leq \operatorname_(0)Notice that

\operatorname{R}XX(0)

is always real.

Cauchy–Schwarz inequality

The Cauchy–Schwarz inequality, inequality for stochastic processes:[1] \left|\operatorname_(t_1,t_2)\right|^2 \leq \operatorname\left[|X_{t_1}|^2\right] \operatorname\left[|X_{t_2}|^2\right]

Autocorrelation of white noise

The autocorrelation of a continuous-time white noise signal will have a strong peak (represented by a Dirac delta function) at

\tau=0

and will be exactly

0

for all other

\tau

.

Wiener–Khinchin theorem

The Wiener–Khinchin theorem relates the autocorrelation function

\operatorname{R}XX

to the power spectral density

SXX

via the Fourier transform:

\operatorname_(\tau) = \int_^\infty S_(f) e^ \, f

S_(f) = \int_^\infty \operatorname_(\tau) e^ \, \tau .

For real-valued functions, the symmetric autocorrelation function has a real symmetric transform, so the Wiener–Khinchin theorem can be re-expressed in terms of real cosines only:

\operatorname_(\tau) = \int_^\infty S_(f) \cos(2 \pi f \tau) \, f

S_(f) = \int_^\infty \operatorname_(\tau) \cos(2 \pi f \tau) \, \tau .

Auto-correlation of random vectors

X=(X1,\ldots,X

\rmT
n)
is an

n x n

matrix containing as elements the autocorrelations of all pairs of elements of the random vector

X

. The autocorrelation matrix is used in various digital signal processing algorithms.

X=(X1,\ldots,X

\rmT
n)
containing random elements whose expected value and variance exist, the auto-correlation matrix is defined by[3] [1]

where

{}\rm

denotes the transposed matrix of dimensions

n x n

.

Written component-wise:

\operatorname_ =\begin\operatorname[X_1 X_1] & \operatorname[X_1 X_2] & \cdots & \operatorname[X_1 X_n] \\ \\\operatorname[X_2 X_1] & \operatorname[X_2 X_2] & \cdots & \operatorname[X_2 X_n] \\ \\ \vdots & \vdots & \ddots & \vdots \\ \\\operatorname[X_n X_1] & \operatorname[X_n X_2] & \cdots & \operatorname[X_n X_n] \\ \\\end

If

Z

is a complex random vector, the autocorrelation matrix is instead defined by

\operatorname_ \triangleq\ \operatorname[\mathbf{Z} \mathbf{Z}^{\rm H}] .

Here

{}\rm

denotes Hermitian transpose.

For example, if

X=\left(X1,X2,X3\right)\rm

is a random vector, then

\operatorname{R}XX

is a

3 x 3

matrix whose

(i,j)

-th entry is

\operatorname{E}[XiXj]

.

Properties of the autocorrelation matrix

aT\operatorname{R}XXa\ge0foralla\inRn

for a real random vector, and respectively

aH\operatorname{R}ZZa\ge0foralla\inCn

in case of a complex random vector.

Auto-correlation of deterministic signals

In signal processing, the above definition is often used without the normalization, that is, without subtracting the mean and dividing by the variance. When the autocorrelation function is normalized by mean and variance, it is sometimes referred to as the autocorrelation coefficient[4] or autocovariance function.

Auto-correlation of continuous-time signal

f(t)

, the continuous autocorrelation

Rff(\tau)

is most often defined as the continuous cross-correlation integral of

f(t)

with itself, at lag

\tau

.[1]

where

\overline{f(t)}

represents the complex conjugate of

f(t)

. Note that the parameter

t

in the integral is a dummy variable and is only necessary to calculate the integral. It has no specific meaning.

Auto-correlation of discrete-time signal

The discrete autocorrelation

R

at lag

\ell

for a discrete-time signal

y(n)

is

The above definitions work for signals that are square integrable, or square summable, that is, of finite energy. Signals that "last forever" are treated instead as random processes, in which case different definitions are needed, based on expected values. For wide-sense-stationary random processes, the autocorrelations are defined as

\beginR_(\tau) &= \operatorname\left[f(t)\overline{f(t-\tau)}\right] \\R_(\ell) &= \operatorname\left[y(n)\,\overline{y(n-\ell)}\right] .\end

For processes that are not stationary, these will also be functions of

t

, or

n

.

For processes that are also ergodic, the expectation can be replaced by the limit of a time average. The autocorrelation of an ergodic process is sometimes defined as or equated to[4]

\beginR_(\tau) &= \lim_ \frac 1 T \int_0^T f(t+\tau)\overline\, t \\R_(\ell) &= \lim_ \frac 1 N \sum_^ y(n)\,\overline .\end

These definitions have the advantage that they give sensible well-defined single-parameter results for periodic functions, even when those functions are not the output of stationary ergodic processes.

Alternatively, signals that last forever can be treated by a short-time autocorrelation function analysis, using finite time integrals. (See short-time Fourier transform for a related process.)

Definition for periodic signals

If

f

is a continuous periodic function of period

T

, the integration from

-infty

to

infty

is replaced by integration over any interval

[t0,t0+T]

of length

T

:

R_(\tau) \triangleq \int_^ f(t+\tau) \overline \,dt

which is equivalent to

R_(\tau) \triangleq \int_^ f(t) \overline \,dt

Properties

In the following, we will describe properties of one-dimensional autocorrelations only, since most properties are easily transferred from the one-dimensional case to the multi-dimensional cases. These properties hold for wide-sense stationary processes.[5]

Rff(\tau)=Rff(-\tau)

, which is easy to prove from the definition. In the continuous case,

Rff(-\tau)=Rff(\tau)

when

f

is a real function, and

Rff(-\tau)=

*(\tau)
R
ff
when

f

is a complex function.

\tau

,

|Rff(\tau)|\leqRff(0)

.[1] This is a consequence of the rearrangement inequality. The same result holds in the discrete case.

\tau

) is the sum of the autocorrelations of each function separately.

*

to represent convolution and

g-1

is a function which manipulates the function

f

and is defined as

g-1(f)(t)=f(-t)

, the definition for

Rff(\tau)

may be written as:R_(\tau) = (f * g_(\overline))(\tau)

Multi-dimensional autocorrelation

Multi-dimensional autocorrelation is defined similarly. For example, in three dimensions the autocorrelation of a square-summable discrete signal would be

R(j,k,\ell) = \sum_ x_\,\overline_ .

When mean values are subtracted from signals before computing an autocorrelation function, the resulting function is usually called an auto-covariance function.

Efficient computation

For data expressed as a discrete sequence, it is frequently necessary to compute the autocorrelation with high computational efficiency. A brute force method based on the signal processing definition

Rxx(j)=\sumnxn\overline{x}n-j

can be used when the signal size is small. For example, to calculate the autocorrelation of the real signal sequence

x=(2,3,-1)

(i.e.

x0=2,x1=3,x2=-1

, and

xi=0

for all other values of) by hand, we first recognize that the definition just given is the same as the "usual" multiplication, but with right shifts, where each vertical addition gives the autocorrelation for particular lag values:\begin & 2 & 3 & -1 \\\times & 2 & 3 & -1 \\\hline &-2 &-3 & 1 \\ & & 6 & 9 & -3 \\ + & & & 4 & 6 & -2 \\\hline & -2 & 3 &14 & 3 & -2\end

Thus the required autocorrelation sequence is

Rxx=(-2,3,14,3,-2)

, where

Rxx(0)=14,

Rxx(-1)=Rxx(1)=3,

and

Rxx(-2)=Rxx(2)=-2,

the autocorrelation for other lag values being zero. In this calculation we do not perform the carry-over operation during addition as is usual in normal multiplication. Note that we can halve the number of operations required by exploiting the inherent symmetry of the autocorrelation. If the signal happens to be periodic, i.e.

x=(\ldots,2,3,-1,2,3,-1,\ldots),

then we get a circular autocorrelation (similar to circular convolution) where the left and right tails of the previous autocorrelation sequence will overlap and give

Rxx=(\ldots,14,1,1,14,1,1,\ldots)

which has the same period as the signal sequence

x.

The procedure can be regarded as an application of the convolution property of Z-transform of a discrete signal.

While the brute force algorithm is order, several efficient algorithms exist which can compute the autocorrelation in order . For example, the Wiener–Khinchin theorem allows computing the autocorrelation from the raw data with two fast Fourier transforms (FFT):[6]

\beginF_R(f) &= \operatorname[X(t)] \\S(f) &= F_R(f) F^*_R(f) \\R(\tau) &= \operatorname[S(f)]\end

where IFFT denotes the inverse fast Fourier transform. The asterisk denotes complex conjugate.

Alternatively, a multiple correlation can be performed by using brute force calculation for low values, and then progressively binning the data with a logarithmic density to compute higher values, resulting in the same efficiency, but with lower memory requirements.[7] [8]

Estimation

For a discrete process with known mean and variance for which we observe

n

observations

\{X1,X2,\ldots,Xn\}

, an estimate of the autocorrelation coefficient may be obtained as

\hat(k)=\frac \sum_^ (X_t-\mu)(X_-\mu)

for any positive integer

k<n

. When the true mean

\mu

and variance

\sigma2

are known, this estimate is unbiased. If the true mean and variance of the process are not known there are several possibilities:

\mu

and

\sigma2

are replaced by the standard formulae for sample mean and sample variance, then this is a biased estimate.

n-k

in the above formula with

n

. This estimate is always biased; however, it usually has a smaller mean squared error.[9] [10]

\{X1,X2,\ldots,Xn-k\}

and

\{Xk+1,Xk+2,\ldots,Xn\}

separately and calculating separate sample means and/or sample variances for use in defining the estimate.

The advantage of estimates of the last type is that the set of estimated autocorrelations, as a function of

k

, then form a function which is a valid autocorrelation in the sense that it is possible to define a theoretical process having exactly that autocorrelation. Other estimates can suffer from the problem that, if they are used to calculate the variance of a linear combination of the

X

's, the variance calculated may turn out to be negative.[11]

Regression analysis

In regression analysis using time series data, autocorrelation in a variable of interest is typically modeled either with an autoregressive model (AR), a moving average model (MA), their combination as an autoregressive-moving-average model (ARMA), or an extension of the latter called an autoregressive integrated moving average model (ARIMA). With multiple interrelated data series, vector autoregression (VAR) or its extensions are used.

In ordinary least squares (OLS), the adequacy of a model specification can be checked in part by establishing whether there is autocorrelation of the regression residuals. Problematic autocorrelation of the errors, which themselves are unobserved, can generally be detected because it produces autocorrelation in the observable residuals. (Errors are also known as "error terms" in econometrics.) Autocorrelation of the errors violates the ordinary least squares assumption that the error terms are uncorrelated, meaning that the Gauss Markov theorem does not apply, and that OLS estimators are no longer the Best Linear Unbiased Estimators (BLUE). While it does not bias the OLS coefficient estimates, the standard errors tend to be underestimated (and the t-scores overestimated) when the autocorrelations of the errors at low lags are positive.

The traditional test for the presence of first-order autocorrelation is the Durbin–Watson statistic or, if the explanatory variables include a lagged dependent variable, Durbin's h statistic. The Durbin-Watson can be linearly mapped however to the Pearson correlation between values and their lags.[12] A more flexible test, covering autocorrelation of higher orders and applicable whether or not the regressors include lags of the dependent variable, is the Breusch–Godfrey test. This involves an auxiliary regression, wherein the residuals obtained from estimating the model of interest are regressed on (a) the original regressors and (b) k lags of the residuals, where 'k' is the order of the test. The simplest version of the test statistic from this auxiliary regression is TR2, where T is the sample size and R2 is the coefficient of determination. Under the null hypothesis of no autocorrelation, this statistic is asymptotically distributed as

\chi2

with k degrees of freedom.

Responses to nonzero autocorrelation include generalized least squares and the Newey–West HAC estimator (Heteroskedasticity and Autocorrelation Consistent).[13]

In the estimation of a moving average model (MA), the autocorrelation function is used to determine the appropriate number of lagged error terms to be included. This is based on the fact that for an MA process of order q, we have

R(\tau)0

, for

\tau=0,1,\ldots,q

, and

R(\tau)=0

, for

\tau>q

.

Applications

Autocorrelation's ability to find repeating patterns in data yields many applications, including:

Serial dependence

Serial dependence is closely linked to the notion of autocorrelation, but represents a distinct concept (see Correlation and dependence). In particular, it is possible to have serial dependence but no (linear) correlation. In some fields however, the two terms are used as synonyms.

A time series of a random variable has serial dependence if the value at some time

t

in the series is statistically dependent on the value at another time

s

. A series is serially independent if there is no dependence between any pair.

If a time series

\left\{Xt\right\}

is stationary, then statistical dependence between the pair

(Xt,Xs)

would imply that there is statistical dependence between all pairs of values at the same lag

\tau=s-t

.

See also

Further reading

Notes and References

  1. Book: Gubner, John A. . 2006 . Probability and Random Processes for Electrical and Computer Engineers . Cambridge University Press . 978-0-521-86470-1.
  2. Kun Il Park, Fundamentals of Probability and Stochastic Processes with Applications to Communications, Springer, 2018,
  3. Papoulis, Athanasius, Probability, Random variables and Stochastic processes, McGraw-Hill, 1991
  4. Book: Dunn, Patrick F. . Measurement and Data Analysis for Engineering and Science . New York . McGraw–Hill . 2005 . 978-0-07-282538-1 .
  5. Book: Proakis. John. Communication Systems Engineering (2nd Edition). August 31, 2001. Pearson. 978-0130617934. 168. 2.
  6. Book: Box . G. E. P. . G. M. . Jenkins . G. C. . Reinsel . Time Series Analysis: Forecasting and Control . 3rd . Upper Saddle River, NJ . Prentice–Hall . 1994 . 978-0130607744 .
  7. Book: D. . Frenkel . B. . Smit . Understanding Molecular Simulation . 2nd . London . Academic Press . 2002 . chap. 4.4.2 . 978-0122673511 .
  8. P. . Colberg . F. . Höfling . Highly accelerated simulations of glassy dynamics using GPUs: caveats on limited floating-point precision . . 182 . 5 . 1120–1129 . 2011 . 10.1016/j.cpc.2011.01.009 . 0912.3824 . 2011CoPhC.182.1120C . 7173093 .
  9. Book: Priestley, M. B. . Spectral Analysis and Time Series . London, New York . Academic Press . 1982 . 978-0125649018 .
  10. Book: Percival, Donald B. . Andrew T. Walden . Spectral Analysis for Physical Applications: Multitaper and Conventional Univariate Techniques . limited . 1993 . Cambridge University Press . 978-0-521-43541-3 . 190–195.
  11. Percival. Donald B.. 1993. Three Curious Properties of the Sample Variance and Autocovariance for Stationary Processes with Unknown Mean. The American Statistician. en. 47. 4. 274–276. 10.1080/00031305.1993.10475997.
  12. Web site: Serial correlation techniques. Statistical Ideas. 26 May 2014.
  13. Book: Baum, Christopher F. . An Introduction to Modern Econometrics Using Stata . Stata Press . 2006 . 978-1-59718-013-9.
  14. Elson. Elliot L.. December 2011. Fluorescence Correlation Spectroscopy: Past, Present, Future. Biophysical Journal. en. 101. 12. 2855–2870. 10.1016/j.bpj.2011.11.012. 3244056. 22208184. 2011BpJ...101.2855E.
  15. Hołyst. Robert. Poniewierski. Andrzej. Zhang. Xuzhu. 2017. Analytical form of the autocorrelation function for the fluorescence correlation spectroscopy. Soft Matter. en. 13. 6. 1267–1275. 10.1039/C6SM02643E. 28106203. 1744-683X. 2017SMat...13.1267H. free.
  16. Book: Van Sickle . Jan . GPS for Land Surveyors . 2008 . CRC Press . 978-0-8493-9195-8 . 18–19 . Third.
  17. Kalvani. Payam Rajabi. Jahangiri. Ali Reza. Shapouri. Samaneh. Sari. Amirhossein. Jalili. Yousef Seyed. August 2019. Multimode AFM analysis of aluminum-doped zinc oxide thin films sputtered under various substrate temperatures for optoelectronic applications. Superlattices and Microstructures. en. 132. 106173. 10.1016/j.spmi.2019.106173. 198468676 .
  18. News: Tyrangiel . Josh . Auto-Tune: Why Pop Music Sounds Perfect . . 2009-02-05 . https://web.archive.org/web/20090210004826/http://www.time.com/time/magazine/article/0,9171,1877372,00.html. dead. February 10, 2009.
  19. Web site: A New Method for Fast Frequency Measurement for Protection Applications . https://ghostarchive.org/archive/20221009/https://cdn.selinc.com/assets/Literature/Publications/Technical%20Papers/6734_NewMethod_BK_20151112_Web.pdf . 2022-10-09 . live . Kasztenny . Bogdan . March 2016 . Schweitzer Engineering Laboratories . 28 May 2022.