Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Autocorrelation
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
{{Short description|Correlation of a signal with a time-shifted copy of itself, as a function of shift}} {{Correlation and covariance}} [[File:Acf new.svg|thumb|300px|right|Above: A plot of a series of 100 random numbers concealing a [[sine]] function. Below: The sine function revealed in a [[correlogram]] produced by autocorrelation.]] [[File:Comparison convolution correlation.svg|thumb|400px|Visual comparison of convolution, [[cross-correlation]], and '''autocorrelation'''. For the operations involving function {{mvar|f}}, and assuming the height of {{mvar|f}} is 1.0, the value of the result at 5 different points is indicated by the shaded area below each point. Also, the symmetry of {{mvar|f}} is the reason <math>g*f</math> and <math>f \star g</math> are identical in this example. <!--Note that g∗f and f∗g would be identical even without the symmetry of f, so please don't change the statement above.-->]] '''Autocorrelation''', sometimes known as '''serial correlation''' in the [[discrete time]] case, measures the [[correlation]] of a [[Signal (information theory)|signal]] with a delayed copy of itself. Essentially, it quantifies the similarity between observations of a [[random variable]] at different points in time. The analysis of autocorrelation is a mathematical tool for identifying repeating patterns or hidden [[Periodic function|periodicities]] within a signal obscured by [[noise (signal processing)|noise]]. Autocorrelation is widely used in [[signal processing]], [[time domain]] and [[time series analysis]] to understand the behavior of data over time. 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]]. Various time series models incorporate autocorrelation, such as [[unit root]] processes, [[trend-stationary process]]es, [[autoregressive process]]es, and [[moving average process]]es. == Autocorrelation of stochastic processes == In [[statistics]], the autocorrelation of a real or complex [[random process]] is the [[Pearson correlation coefficient|Pearson correlation]] between values of the process at different times, as a function of the two times or of the time lag. Let <math>\left\{ X_t \right\}</math> be a random process, and <math>t</math> be any point in time (<math>t</math> may be an [[integer]] for a [[discrete-time]] process or a [[real number]] for a [[continuous-time]] process). Then <math>X_t</math> is the value (or [[Realization (probability)|realization]]) produced by a given [[Execution (computing)|run]] of the process at time <math>t</math>. Suppose that the process has [[mean]] <math>\mu_t</math> and [[variance]] <math>\sigma_t^2</math> at time <math>t</math>, for each <math>t</math>. Then the definition of the '''autocorrelation function''' between times <math>t_1</math> and <math>t_2</math> is<ref name=Gubner>{{cite book |first=John A. |last=Gubner |year=2006 |title=Probability and Random Processes for Electrical and Computer Engineers |publisher=Cambridge University Press |isbn=978-0-521-86470-1}}</ref>{{rp|p.388}}<ref name=KunIlPark>Kun Il Park, Fundamentals of Probability and Stochastic Processes with Applications to Communications, Springer, 2018, {{ISBN|978-3-319-68074-3}}</ref>{{rp|p.165}} {{Equation box 1 |indent = : |title= |equation = <math>\operatorname{R}_{XX}(t_1,t_2) = \operatorname{E} \left[ X_{t_1} \overline{X}_{t_2}\right]</math> |cellpadding= 6 |border colour = #0073CF |background colour=#F5FFFA}} where <math>\operatorname{E}</math> 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 <math>t_1</math> and <math>t_2</math>:<ref name=Gubner/>{{rp|p.392}}<ref name=KunIlPark/>{{rp|p.168}} {{Equation box 1 |indent = : |title= |equation = <math> \begin{align} \operatorname{K}_{XX}(t_1,t_2) &= \operatorname{E} \left[ (X_{t_1} - \mu_{t_1})\overline{(X_{t_2} - \mu_{t_2})} \right] \\ &= \operatorname{E}\left[X_{t_1} \overline{X}_{t_2} \right] - \mu_{t_1}\overline{\mu}_{t_2} \\ &= \operatorname{R}_{XX}(t_1,t_2) - \mu_{t_1}\overline{\mu}_{t_2} \end{align} </math> |cellpadding= 6 |border colour = #0073CF |background colour=#F5FFFA}} 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 <math>\left\{ X_t \right\}</math> is a [[wide-sense stationary process]] then the mean <math>\mu</math> and the variance <math>\sigma^2</math> are time-independent, and further the autocovariance function depends only on the lag between <math>t_1</math> and <math>t_2</math>: 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 autocorrelation can be expressed as a function of the time-lag, and that this would be an [[even function]] of the lag <math>\tau=t_2-t_1</math>. This gives the more familiar forms for the '''autocorrelation function'''<ref name=Gubner/>{{rp|p.395}} {{Equation box 1 |indent = : |title= |equation = <math>\operatorname{R}_{XX}(\tau) = \operatorname{E}\left[X_{t+\tau} \overline{X}_{t} \right]</math> |cellpadding= 6 |border colour = #0073CF |background colour=#F5FFFA}} and the '''auto-covariance function''': {{Equation box 1 |indent = : |title= |equation = <math> \begin{align} \operatorname{K}_{XX}(\tau) &= \operatorname{E}\left[ (X_{t+\tau} - \mu)\overline{(X_{t} - \mu)} \right] \\ &= \operatorname{E} \left[ X_{t+\tau} \overline{X}_{t} \right] - \mu\overline{\mu} \\ &= \operatorname{R}_{XX}(\tau) - \mu\overline{\mu} \end{align} </math> |cellpadding= 6 |border colour = #0073CF |background colour=#F5FFFA}} In particular, note that <math display=block>\operatorname{K}_{XX}(0) = \sigma^2 .</math> === 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 autocorrelation coefficient of a stochastic process is<ref name=KunIlPark/>{{rp|p.169}} <math display=block>\rho_{XX}(t_1,t_2) = \frac{\operatorname{K}_{XX}(t_1,t_2)}{\sigma_{t_1}\sigma_{t_2}} = \frac{\operatorname{E}\left[(X_{t_1} - \mu_{t_1}) \overline{(X_{t_2} - \mu_{t_2})} \right]}{\sigma_{t_1}\sigma_{t_2}} .</math> If the function <math>\rho_{XX}</math> is well defined, its value must lie in the range <math>[-1,1]</math>, with 1 indicating perfect correlation and −1 indicating perfect [[anti-correlation]]. For a [[Stationary process#wide-sense stationarity|wide-sense stationary]] (WSS) process, the definition is <math display=block>\rho_{XX}(\tau) = \frac{\operatorname{K}_{XX}(\tau)}{\sigma^2} = \frac{\operatorname{E} \left[(X_{t+\tau} - \mu)\overline{(X_{t} - \mu)}\right]}{\sigma^2}</math>. 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 autocorrelation function <math>\operatorname{R}_{XX}</math> is an [[even function]] can be stated as<ref name=KunIlPark/>{{rp|p.171}} <math display=block>\operatorname{R}_{XX}(t_1,t_2) = \overline{\operatorname{R}_{XX}(t_2,t_1)}</math> respectively for a WSS process:<ref name=KunIlPark/>{{rp|p.173}} <math display=block>\operatorname{R}_{XX}(\tau) = \overline{\operatorname{R}_{XX}(-\tau)} .</math> ====Maximum at zero==== For a WSS process:<ref name=KunIlPark/>{{rp|p.174}} <math display=block>\left|\operatorname{R}_{XX}(\tau)\right| \leq \operatorname{R}_{XX}(0)</math> Notice that <math>\operatorname{R}_{XX}(0)</math> is always real. ====Cauchy–Schwarz inequality==== The [[Cauchy–Schwarz inequality]], inequality for stochastic processes:<ref name=Gubner/>{{rp|p.392}} <math display=block>\left|\operatorname{R}_{XX}(t_1,t_2)\right|^2 \leq \operatorname{E}\left[ |X_{t_1}|^2\right] \operatorname{E}\left[|X_{t_2}|^2\right]</math> ====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 <math>\tau=0</math> and will be exactly <math>0</math> for all other <math>\tau</math>. ====Wiener–Khinchin theorem==== The [[Wiener–Khinchin theorem]] relates the autocorrelation function <math>\operatorname{R}_{XX}</math> to the [[spectral density|power spectral density]] <math>S_{XX}</math> via the [[Fourier transform]]: <math display=block>\operatorname{R}_{XX}(\tau) = \int_{-\infty}^\infty S_{XX}(f) e^{i 2 \pi f \tau} \, {\rm d}f</math> <math display=block>S_{XX}(f) = \int_{-\infty}^\infty \operatorname{R}_{XX}(\tau) e^{- i 2 \pi f \tau} \, {\rm d}\tau .</math> 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: <math display=block>\operatorname{R}_{XX}(\tau) = \int_{-\infty}^\infty S_{XX}(f) \cos(2 \pi f \tau) \, {\rm d}f</math> <math display=block>S_{XX}(f) = \int_{-\infty}^\infty \operatorname{R}_{XX}(\tau) \cos(2 \pi f \tau) \, {\rm d}\tau .</math> ==Autocorrelation of random vectors{{anchor|Matrix}}== The (potentially time-dependent) '''autocorrelation matrix''' (also called second moment) of a (potentially time-dependent) [[random vector]] <math>\mathbf{X} = (X_1,\ldots,X_n)^{\rm T}</math> is an <math>n \times n</math> matrix containing as elements the autocorrelations of all pairs of elements of the random vector <math>\mathbf{X}</math>. The autocorrelation matrix is used in various [[digital signal processing]] algorithms. For a [[random vector]] <math>\mathbf{X} = (X_1,\ldots,X_n)^{\rm T}</math> containing [[random element]]s whose [[expected value]] and [[variance]] exist, the '''autocorrelation matrix''' is defined by<ref name=Papoulis>Papoulis, Athanasius, ''Probability, Random variables and Stochastic processes'', McGraw-Hill, 1991</ref>{{rp|p.190}}<ref name=Gubner/>{{rp|p.334}} {{Equation box 1 |indent = : |title= |equation = <math>\operatorname{R}_{\mathbf{X}\mathbf{X}} \triangleq\ \operatorname{E} \left[ \mathbf{X} \mathbf{X}^{\rm T} \right] </math> |cellpadding= 6 |border |border colour = #0073CF |background colour=#F5FFFA}} where <math>{}^{\rm T}</math> denotes the [[transpose]]d matrix of dimensions <math>n \times n</math>. Written component-wise: <math display=block>\operatorname{R}_{\mathbf{X}\mathbf{X}} = \begin{bmatrix} \operatorname{E}[X_1 X_1] & \operatorname{E}[X_1 X_2] & \cdots & \operatorname{E}[X_1 X_n] \\ \\ \operatorname{E}[X_2 X_1] & \operatorname{E}[X_2 X_2] & \cdots & \operatorname{E}[X_2 X_n] \\ \\ \vdots & \vdots & \ddots & \vdots \\ \\ \operatorname{E}[X_n X_1] & \operatorname{E}[X_n X_2] & \cdots & \operatorname{E}[X_n X_n] \\ \\ \end{bmatrix} </math> If <math>\mathbf{Z}</math> is a [[complex random vector]], the autocorrelation matrix is instead defined by <math display=block>\operatorname{R}_{\mathbf{Z}\mathbf{Z}} \triangleq\ \operatorname{E}[\mathbf{Z} \mathbf{Z}^{\rm H}] .</math> Here <math>{}^{\rm H}</math> denotes [[Hermitian transpose]]. For example, if <math>\mathbf{X} = \left( X_1,X_2,X_3 \right)^{\rm T}</math> is a random vector, then <math>\operatorname{R}_{\mathbf{X}\mathbf{X}}</math> is a <math>3 \times 3</math> matrix whose <math>(i,j)</math>-th entry is <math>\operatorname{E}[X_i X_j]</math>. ===Properties of the autocorrelation matrix=== * The autocorrelation matrix is a [[Hermitian matrix]] for complex random vectors and a [[symmetric matrix]] for real random vectors.<ref name=Papoulis />{{rp|p.190}} * The autocorrelation matrix is a [[positive semidefinite matrix]],<ref name=Papoulis />{{rp|p.190}} i.e. <math>\mathbf{a}^{\mathrm T} \operatorname{R}_{\mathbf{X}\mathbf{X}} \mathbf{a} \ge 0 \quad \text{for all } \mathbf{a} \in \mathbb{R}^n</math> for a real random vector, and respectively <math>\mathbf{a}^{\mathrm H} \operatorname{R}_{\mathbf{Z}\mathbf{Z}} \mathbf{a} \ge 0 \quad \text{for all } \mathbf{a} \in \mathbb{C}^n</math> in case of a complex random vector. * All eigenvalues of the autocorrelation matrix are real and non-negative. * The ''auto-covariance matrix'' is related to the autocorrelation matrix as follows:<!-- --><math display=block>\operatorname{K}_{\mathbf{X}\mathbf{X}} = \operatorname{E}[(\mathbf{X} - \operatorname{E}[\mathbf{X}])(\mathbf{X} - \operatorname{E}[\mathbf{X}])^{\rm T}] = \operatorname{R}_{\mathbf{X}\mathbf{X}} - \operatorname{E}[\mathbf{X}] \operatorname{E}[\mathbf{X}]^{\rm T}</math><!-- -->Respectively for complex random vectors:<!-- --><math display=block>\operatorname{K}_{\mathbf{Z}\mathbf{Z}} = \operatorname{E}[(\mathbf{Z} - \operatorname{E}[\mathbf{Z}])(\mathbf{Z} - \operatorname{E}[\mathbf{Z}])^{\rm H}] = \operatorname{R}_{\mathbf{Z}\mathbf{Z}} - \operatorname{E}[\mathbf{Z}] \operatorname{E}[\mathbf{Z}]^{\rm H}</math> == Autocorrelation 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'''<ref name="dunn">{{cite book |first=Patrick F. |last=Dunn |title=Measurement and Data Analysis for Engineering and Science |location=New York |publisher=McGraw–Hill |year=2005 |isbn=978-0-07-282538-1 }}</ref> or autocovariance function. === Autocorrelation of continuous-time signal === Given a [[Signal (electronics)|signal]] <math>f(t)</math>, the continuous autocorrelation <math>R_{ff}(\tau)</math> is most often defined as the continuous [[cross-correlation]] integral of <math>f(t)</math> with itself, at lag <math>\tau</math>.<ref name=Gubner/>{{rp|p.411}} {{Equation box 1 |indent = : |title= |equation = <math>R_{ff}(\tau) = \int_{-\infty}^\infty f(t+\tau)\overline{f(t)}\, {\rm d}t = \int_{-\infty}^\infty f(t) \overline{f(t-\tau)}\, {\rm d}t</math> |cellpadding= 6 |border |border colour = #0073CF |background colour=#F5FFFA}} where <math>\overline{f(t)}</math> represents the [[complex conjugate]] of <math>f(t)</math>. Note that the parameter <math>t</math> in the integral is a dummy variable and is only necessary to calculate the integral. It has no specific meaning. === Autocorrelation of discrete-time signal === The discrete autocorrelation <math>R</math> at lag <math>\ell</math> for a discrete-time signal <math>y(n)</math> is {{Equation box 1 |indent = : |title= |equation = <math>R_{yy}(\ell) = \sum_{n \in Z} y(n)\,\overline{y(n-\ell)}</math> |cellpadding= 6 |border |border colour = #0073CF |background colour=#F5FFFA}} 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 process]]es, the autocorrelations are defined as <math display=block>\begin{align} R_{ff}(\tau) &= \operatorname{E}\left[f(t)\overline{f(t-\tau)}\right] \\ R_{yy}(\ell) &= \operatorname{E}\left[y(n)\,\overline{y(n-\ell)}\right] . \end{align}</math> For processes that are not [[Stationary process|stationary]], these will also be functions of <math>t</math>, or <math>n</math>. For processes that are also [[Ergodic process|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<ref name="dunn"/> <math display=block>\begin{align} R_{ff}(\tau) &= \lim_{T \rightarrow \infty} \frac 1 T \int_0^T f(t+\tau)\overline{f(t)}\, {\rm d}t \\ R_{yy}(\ell) &= \lim_{N \rightarrow \infty} \frac 1 N \sum_{n=0}^{N-1} y(n)\,\overline{y(n-\ell)} . \end{align}</math> 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 <math>f</math> is a continuous periodic function of period <math>T</math>, the integration from <math>-\infty</math> to <math>\infty</math> is replaced by integration over any interval <math>[t_0,t_0+T]</math> of length <math>T</math>: <math display=block>R_{ff}(\tau) \triangleq \int_{t_0}^{t_0+T} f(t+\tau) \overline{f(t)} \,dt</math> which is equivalent to <math display=block>R_{ff}(\tau) \triangleq \int_{t_0}^{t_0+T} f(t) \overline{f(t-\tau)} \,dt</math> ===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 [[Stationary process#Weak or wide-sense stationarity|wide-sense stationary processes]].<ref>{{cite book|last1=Proakis|first1=John|title=Communication Systems Engineering (2nd Edition)|date=August 31, 2001|publisher=Pearson|isbn=978-0130617934|page=168|edition=2}}</ref> * A fundamental property of the autocorrelation is symmetry, <math>R_{ff}(\tau) = R_{ff}(-\tau)</math>, which is easy to prove from the definition. In the continuous case, ** the autocorrelation is an [[even function]] <math>R_{ff}(-\tau) = R_{ff}(\tau)</math> when <math>f</math> is a real function, and ** the autocorrelation is a [[Hermitian function]] <math>R_{ff}(-\tau) = R_{ff}^*(\tau)</math> when <math>f</math> is a [[complex function]]. * The continuous autocorrelation function reaches its peak at the origin, where it takes a real value, i.e. for any delay <math>\tau</math>, <math>|R_{ff}(\tau)| \leq R_{ff}(0)</math>.<ref name=Gubner/>{{rp|p.410}} This is a consequence of the [[rearrangement inequality]]. The same result holds in the discrete case. * The autocorrelation of a [[periodic function]] is, itself, periodic with the same period. * The autocorrelation of the sum of two completely uncorrelated functions (the cross-correlation is zero for all <math>\tau</math>) is the sum of the autocorrelations of each function separately. * Since autocorrelation is a specific type of [[cross-correlation]], it maintains all the properties of cross-correlation. * By using the symbol <math>*</math> to represent [[convolution]] and <math>g_{-1}</math> is a function which manipulates the function <math>f</math> and is defined as <math>g_{-1}(f)(t)=f(-t)</math>, the definition for <math>R_{ff}(\tau)</math> may be written as:<!-- --><math display=block>R_{ff}(\tau) = (f * g_{-1}(\overline{f}))(\tau)</math> ==Multi-dimensional autocorrelation== Multi-[[dimension]]al autocorrelation is defined similarly. For example, in [[Three-dimensional space|three dimensions]] the autocorrelation of a square-summable [[discrete signal]] would be <math display=block>R(j,k,\ell) = \sum_{n,q,r} x_{n,q,r}\,\overline{x}_{n-j,q-k,r-\ell} .</math> 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 signal|discrete]] sequence, it is frequently necessary to compute the autocorrelation with high [[algorithmic efficiency|computational efficiency]]. A [[brute force method]] based on the signal processing definition <math>R_{xx}(j) = \sum_n x_n\,\overline{x}_{n-j}</math> can be used when the signal size is small. For example, to calculate the autocorrelation of the real signal sequence <math>x = (2,3,-1)</math> (i.e. <math>x_0=2, x_1=3, x_2=-1</math>, and <math>x_i = 0</math> for all other values of {{mvar|i}}) 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: <math display=block>\begin{array}{rrrrrr} & 2 & 3 & -1 \\ \times & 2 & 3 & -1 \\ \hline &-2 &-3 & 1 \\ & & 6 & 9 & -3 \\ + & & & 4 & 6 & -2 \\ \hline & -2 & 3 &14 & 3 & -2 \end{array}</math> Thus the required autocorrelation sequence is <math>R_{xx}=(-2,3,14,3,-2)</math>, where <math>R_{xx}(0)=14,</math> <math>R_{xx}(-1)= R_{xx}(1)=3,</math> and <math>R_{xx}(-2)= R_{xx}(2) = -2,</math> 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. <math>x=(\ldots,2,3,-1,2,3,-1,\ldots),</math> 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 <math>R_{xx}=(\ldots,14,1,1,14,1,1,\ldots)</math> which has the same period as the signal sequence <math>x.</math> 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 [[Big O notation|order]] {{math|''n''<sup>2</sup>}}, several efficient algorithms exist which can compute the autocorrelation in order {{math|''n'' log(''n'')}}. For example, the [[Wiener–Khinchin theorem]] allows computing the autocorrelation from the raw data {{math|''X''(''t'')}} with two [[fast Fourier transform]]s (FFT):<ref>{{cite book |last1=Box |first1=G. E. P. |first2=G. M. |last2=Jenkins |first3=G. C. |last3=Reinsel |title=Time Series Analysis: Forecasting and Control |edition=3rd |location=Upper Saddle River, NJ |publisher=Prentice–Hall |year=1994 |isbn=978-0130607744 }}</ref>{{page needed|date=March 2013}} <math display=block>\begin{align} F_R(f) &= \operatorname{FFT}[X(t)] \\ S(f) &= F_R(f) F^*_R(f) \\ R(\tau) &= \operatorname{IFFT}[S(f)] \end{align}</math> where IFFT denotes the inverse [[fast Fourier transform]]. The asterisk denotes [[complex conjugate]]. Alternatively, a multiple {{mvar|τ}} correlation can be performed by using brute force calculation for low {{mvar|τ}} values, and then progressively binning the {{math|''X''(''t'')}} data with a [[logarithm]]ic density to compute higher values, resulting in the same {{math|''n'' log(''n'')}} efficiency, but with lower memory requirements.<ref>{{cite book |first1=D. |last1=Frenkel |first2=B. |last2=Smit |title=Understanding Molecular Simulation |edition=2nd |location=London |publisher=Academic Press |year=2002 |chapter=chap. 4.4.2 |isbn=978-0122673511 }}</ref><ref>{{cite journal |first1=P. |last1=Colberg |first2=F. |last2=Höfling |title=Highly accelerated simulations of glassy dynamics using GPUs: caveats on limited floating-point precision |journal=[[Computer Physics Communications|Comput. Phys. Commun.]] |volume=182 |issue=5 |pages=1120–1129 |year=2011 |doi=10.1016/j.cpc.2011.01.009 |arxiv=0912.3824 |bibcode=2011CoPhC.182.1120C |s2cid=7173093 }}</ref> ==Estimation== For a [[Discrete signal|discrete]] process with known mean and variance for which we observe <math>n</math> observations <math>\{X_1,\,X_2,\,\ldots,\,X_n\}</math>, an estimate of the autocorrelation coefficient may be obtained as <math display=block> \hat{R}(k)=\frac{1}{(n-k) \sigma^2} \sum_{t=1}^{n-k} (X_t-\mu)(X_{t+k}-\mu) </math> for any positive integer <math>k<n</math>. When the true mean <math>\mu</math> and variance <math>\sigma^2</math> are known, this estimate is '''[[Biased estimator|unbiased]]'''. If the true mean and [[variance]] of the process are not known there are several possibilities: * If <math>\mu</math> and <math>\sigma^2</math> are replaced by the standard formulae for sample mean and sample variance, then this is a '''[[Biased estimator|biased estimate]]'''. * A [[periodogram]]-based estimate replaces <math>n-k</math> in the above formula with <math>n</math>. This estimate is always biased; however, it usually has a smaller [[mean squared error]].<ref>{{cite book |title=Spectral Analysis and Time Series |first=M. B. |last=Priestley |location=London, New York |publisher=Academic Press |year=1982 |isbn=978-0125649018 }}</ref><ref>{{cite book | last=Percival | first=Donald B. | author2=Andrew T. Walden | title=Spectral Analysis for Physical Applications: Multitaper and Conventional Univariate Techniques | url=https://archive.org/details/spectralanalysis00perc_105 | url-access=limited | year=1993 | publisher=Cambridge University Press | isbn=978-0-521-43541-3 | pages=[https://archive.org/details/spectralanalysis00perc_105/page/n217 190]–195}}</ref> * Other possibilities derive from treating the two portions of data <math>\{X_1,\,X_2,\,\ldots,\,X_{n-k}\}</math> and <math>\{X_{k+1},\,X_{k+2},\,\ldots,\,X_n\}</math> separately and calculating separate sample means and/or sample variances for use in defining the estimate.{{Citation needed|date=May 2020}}<!--I really can't find a citation for that last type of estimator, even though I can verify numerically that it solves the negativity issue raise in doi:10.1080/00031305.1993.10475997--> The advantage of estimates of the last type is that the set of estimated autocorrelations, as a function of <math>k</math>, 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 <math>X</math>'s, the variance calculated may turn out to be negative.<ref>{{Cite journal|last=Percival|first=Donald B.|date=1993|title=Three Curious Properties of the Sample Variance and Autocovariance for Stationary Processes with Unknown Mean|journal=The American Statistician|language=en|volume=47|issue=4|pages=274–276|doi=10.1080/00031305.1993.10475997}}</ref> ==Regression analysis== In [[regression analysis]] using [[time series analysis|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 [[errors and residuals in statistics|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|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 error (statistics)|standard errors]] tend to be underestimated (and the [[T-statistics|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–Watson statistic#Durbin h-statistic|Durbin's h statistic]]. The Durbin-Watson can be linearly mapped however to the Pearson correlation between values and their lags.<ref>{{cite web|url=http://statisticalideas.blogspot.com/2014/05/serial-correlation-techniques.html|work= Statistical Ideas|title= Serial correlation techniques|date = 26 May 2014}}</ref> 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 ''TR''<sup>2</sup>, where ''T'' is the sample size and ''R''<sup>2</sup> is the [[coefficient of determination]]. Under the null hypothesis of no autocorrelation, this statistic is asymptotically [[Chi-squared distribution|distributed as <math>\chi^2</math>]] with ''k'' degrees of freedom. Responses to nonzero autocorrelation include [[generalized least squares]] and the [[Newey West|Newey–West HAC estimator]] (Heteroskedasticity and Autocorrelation Consistent).<ref>{{cite book | title = An Introduction to Modern Econometrics Using Stata |first= Christopher F. |last=Baum | publisher = Stata Press | year = 2006 | isbn = 978-1-59718-013-9}}</ref> 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 <math>R(\tau) \neq 0</math>, for <math> \tau = 0,1, \ldots , q</math>, and <math> R(\tau) = 0</math>, for <math>\tau >q</math>. ==Applications== Autocorrelation's ability to find repeating patterns in [[data]] yields many applications, including: * Autocorrelation analysis is used heavily in [[fluorescence correlation spectroscopy]]<ref>{{Cite journal|last=Elson|first=Elliot L.|date=December 2011|title=Fluorescence Correlation Spectroscopy: Past, Present, Future|journal=Biophysical Journal|language=en|volume=101|issue=12|pages=2855–2870|doi=10.1016/j.bpj.2011.11.012|pmc=3244056|pmid=22208184|bibcode=2011BpJ...101.2855E}}</ref> to provide quantitative insight into molecular-level diffusion and chemical reactions.<ref>{{Cite journal|last1=Hołyst|first1=Robert|last2=Poniewierski|first2=Andrzej|last3=Zhang|first3=Xuzhu|date=2017|title=Analytical form of the autocorrelation function for the fluorescence correlation spectroscopy|journal=Soft Matter|language=en|volume=13|issue=6|pages=1267–1275|doi=10.1039/C6SM02643E|pmid=28106203|issn=1744-683X|bibcode=2017SMat...13.1267H|doi-access=free}}</ref> * Another application of autocorrelation is the measurement of [[optical spectrum|optical spectra]] and the measurement of very-short-duration [[light]] [[ultrashort pulse|pulses]] produced by [[laser]]s, both using [[optical autocorrelation|optical autocorrelators]]. * Autocorrelation is used to analyze [[dynamic light scattering]] data, which notably enables determination of the [[particle size distribution]]s of nanometer-sized particles or [[micelle]]s suspended in a fluid. A laser shining into the mixture produces a [[speckle pattern]] that results from the motion of the particles. Autocorrelation of the signal can be analyzed in terms of the diffusion of the particles. From this, knowing the viscosity of the fluid, the sizes of the particles can be calculated. * Utilized in the [[GPS]] system to correct for the [[propagation delay]], or time shift, between the point of time at the transmission of the [[carrier signal]] at the satellites, and the point of time at the receiver on the ground. This is done by the receiver generating a replica signal of the 1,023-bit C/A (Coarse/Acquisition) code, and generating lines of code chips [-1,1] in packets of ten at a time, or 10,230 chips (1,023 × 10), shifting slightly as it goes along in order to accommodate for the [[doppler shift]] in the incoming satellite signal, until the receiver replica signal and the satellite signal codes match up.<ref>{{cite book |last1=Van Sickle |first1=Jan |title=GPS for Land Surveyors |date=2008 |publisher=CRC Press |isbn=978-0-8493-9195-8 |pages=18–19 |edition=Third}}</ref> * The [[small-angle X-ray scattering]] intensity of a nanostructured system is the Fourier transform of the spatial autocorrelation function of the electron density. *In [[surface science]] and [[scanning probe microscopy]], autocorrelation is used to establish a link between surface morphology and functional characteristics.<ref>{{Cite journal|last1=Kalvani|first1=Payam Rajabi|last2=Jahangiri|first2=Ali Reza|last3=Shapouri|first3=Samaneh|last4=Sari|first4=Amirhossein|last5=Jalili|first5=Yousef Seyed|date=August 2019|title=Multimode AFM analysis of aluminum-doped zinc oxide thin films sputtered under various substrate temperatures for optoelectronic applications|journal=Superlattices and Microstructures|language=en|volume=132|pages=106173|doi=10.1016/j.spmi.2019.106173|s2cid=198468676 }}</ref> * In optics, normalized autocorrelations and cross-correlations give the [[degree of coherence]] of an electromagnetic field. * In [[astronomy]], autocorrelation can determine the [[frequency]] of [[pulsar]]s. * In [[music]], autocorrelation (when applied at time scales smaller than a second) is used as a [[pitch detection algorithm]] for both instrument tuners and "Auto Tune" (used as a [[Distortion (music)|distortion]] effect or to fix intonation).<ref>{{Cite news | last1 = Tyrangiel | first1 = Josh | title = Auto-Tune: Why Pop Music Sounds Perfect | magazine = [[Time (magazine)|Time]] | date = 2009-02-05 | url = http://www.time.com/time/magazine/article/0,9171,1877372,00.html| archive-url = https://web.archive.org/web/20090210004826/http://www.time.com/time/magazine/article/0,9171,1877372,00.html| url-status = dead| archive-date = February 10, 2009}}</ref> When applied at time scales larger than a second, autocorrelation can identify the [[Beat (music)|musical beat]], for example to determine [[tempo]]. * Autocorrelation in space rather than time, via the [[Patterson function]], is used by X-ray diffractionists to help recover the "Fourier phase information" on atom positions not available through diffraction alone. * In statistics, spatial autocorrelation between sample locations also helps one estimate [[Variance generalizations|mean value uncertainties]] when sampling a heterogeneous population. * The [[SEQUEST]] algorithm for analyzing [[Mass spectrum|mass spectra]] makes use of autocorrelation in conjunction with [[cross-correlation]] to score the similarity of an observed spectrum to an idealized spectrum representing a [[peptide]]. * In [[astrophysics]], autocorrelation is used to study and characterize the spatial distribution of [[Galaxy|galaxies]] in the universe and in multi-wavelength observations of low mass [[X-ray binary|X-ray binaries]]. * In [[panel data]], spatial autocorrelation refers to correlation of a variable with itself through space. * In analysis of [[Markov chain Monte Carlo]] data, autocorrelation must be taken into account for correct error determination. * In [[geosciences]] (specifically in [[geophysics]]) it can be used to compute an autocorrelation seismic attribute, out of a 3D seismic survey of the underground. * In [[medical ultrasound]] imaging, autocorrelation is used to visualize blood flow. * In [[intertemporal portfolio choice]], the presence or absence of autocorrelation in an asset's [[rate of return]] can affect the optimal portion of the portfolio to hold in that asset. * In [[numerical relay]]s, autocorrelation has been used to accurately measure power system frequency.<ref>{{cite web |url=https://cdn.selinc.com/assets/Literature/Publications/Technical%20Papers/6734_NewMethod_BK_20151112_Web.pdf |archive-url=https://ghostarchive.org/archive/20221009/https://cdn.selinc.com/assets/Literature/Publications/Technical%20Papers/6734_NewMethod_BK_20151112_Web.pdf |archive-date=2022-10-09 |url-status=live |title=A New Method for Fast Frequency Measurement for Protection Applications |last=Kasztenny |first=Bogdan |date= March 2016 |publisher=Schweitzer Engineering Laboratories |access-date=28 May 2022}}</ref> == 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 <math>t</math> in the series is [[Statistical independence|statistically dependent]] on the value at another time <math>s</math>. A series is serially independent if there is no dependence between any pair. If a time series <math>\left\{ X_t \right\}</math> is [[Stationary process|stationary]], then statistical dependence between the pair <math>(X_t,X_s)</math> would imply that there is statistical dependence between all pairs of values at the same lag <math>\tau=s-t</math>. ==See also== {{Div col|colwidth=40em}} * [[Autocorrelation matrix]] * [[Autocorrelation (words)|Autocorrelation of a formal word]] * [[Autocorrelation technique]] * [[Autocorrelator]] * [[Cochrane–Orcutt estimation]] (transformation for autocorrelated error terms) * [[Correlation function]] * [[Correlogram]] * [[Cross-correlation]] * [[CUSUM]] * [[Fluorescence correlation spectroscopy]] * [[Optical autocorrelation]] * [[Partial autocorrelation function]] * [[Phylogenetic autocorrelation]] (Galton's problem) * [[Pitch detection algorithm]] * [[Prais–Winsten transformation]] * [[Scaled correlation]] * [[Triple correlation]] * [[Unbiased estimation of standard deviation#Effect of autocorrelation (serial correlation)|Unbiased estimation of standard deviation]] {{Div col end}} ==References== {{reflist}} ==Further reading== * {{cite book |last=Kmenta |first=Jan |author-link=Jan Kmenta |title=Elements of Econometrics |location=New York |publisher=Macmillan |year=1986 |edition=Second |isbn=978-0-02-365070-3 |pages=[https://archive.org/details/elementsofeconom0003kmen/page/298 298–334] |url-access=registration |url=https://archive.org/details/elementsofeconom0003kmen/page/298 }} * {{cite book|author=Marno Verbeek|author-link = Marno Verbeek|title=A Guide to Modern Econometrics|url=https://books.google.com/books?id=SQxDDwAAQBAJ|date=10 August 2017|publisher=Wiley|isbn=978-1-119-40110-0}} * {{cite journal | url=https://ieeexplore.ieee.org/document/6142119 | doi=10.1109/TSP.2012.2186134 | bibcode=2012ITSP...60.2180S | title=Computational Design of Sequences with Good Correlation Properties | last1=Soltanalian | first1=Mojtaba | last2=Stoica | first2=Petre | journal=IEEE Transactions on Signal Processing | date=2012 | volume=60 | issue=5 | page=2180 }} * Solomon W. Golomb, and [[Guang Gong]]. [http://www.cambridge.org/us/academic/subjects/computer-science/cryptography-cryptology-and-coding/signal-design-good-correlation-wireless-communication-cryptography-and-radar Signal design for good correlation: for wireless communication, cryptography, and radar]. Cambridge University Press, 2005. * Klapetek, Petr (2018). ''[https://www.elsevier.com/books/quantitative-data-processing-in-scanning-probe-microscopy/klapetek/978-0-12-813347-7 Quantitative Data Processing in Scanning Probe Microscopy: SPM Applications for Nanometrology]'' (Second ed.). Elsevier. pp. 108–112 {{ISBN|9780128133477}}. * {{MathWorld | urlname=Autocorrelation | title=Autocorrelation}} {{Statistics|analysis}} [[Category:Autocorrelation| ]] [[Category:Signal processing]] [[Category:Time domain analysis]]
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)
Pages transcluded onto the current version of this page
(
help
)
:
Template:Anchor
(
edit
)
Template:Citation needed
(
edit
)
Template:Cite book
(
edit
)
Template:Cite journal
(
edit
)
Template:Cite news
(
edit
)
Template:Cite web
(
edit
)
Template:Correlation and covariance
(
edit
)
Template:Div col
(
edit
)
Template:Div col end
(
edit
)
Template:Equation box 1
(
edit
)
Template:ISBN
(
edit
)
Template:Math
(
edit
)
Template:MathWorld
(
edit
)
Template:Mvar
(
edit
)
Template:Page needed
(
edit
)
Template:Reflist
(
edit
)
Template:Rp
(
edit
)
Template:SfnRef
(
edit
)
Template:Short description
(
edit
)
Template:Statistics
(
edit
)