Hubbry Logo
Cross-correlationCross-correlationMain
Open search
Cross-correlation
Community hub
Cross-correlation
logo
8 pages, 0 posts
0 subscribers
Be the first to start a discussion here.
Be the first to start a discussion here.
Cross-correlation
Cross-correlation
from Wikipedia
Visual comparison of convolution, cross-correlation and autocorrelation. For the operations involving function f, and assuming the height of f is 1.0, the value of the result at 5 different points is indicated by the shaded area below each point. Also, the vertical symmetry of f is the reason and are identical in this example.

In signal processing, cross-correlation is a measure of similarity of two series as a function of the displacement of one relative to the other. This is also known as a sliding dot product or sliding inner-product. It is commonly used for searching a long signal for a shorter, known feature. It has applications in pattern recognition, single particle analysis, electron tomography, averaging, cryptanalysis, and neurophysiology. The cross-correlation is similar in nature to the convolution of two functions. In an autocorrelation, which is the cross-correlation of a signal with itself, there will always be a peak at a lag of zero, and its size will be the signal energy.

In probability and statistics, the term cross-correlations refers to the correlations between the entries of two random vectors and , while the correlations of a random vector are the correlations between the entries of itself, those forming the correlation matrix of . If each of and is a scalar random variable which is realized repeatedly in a time series, then the correlations of the various temporal instances of are known as autocorrelations of , and the cross-correlations of with across time are temporal cross-correlations. In probability and statistics, the definition of correlation always includes a standardising factor in such a way that correlations have values between −1 and +1.

If and are two independent random variables with probability density functions and , respectively, then the probability density of the difference is formally given by the cross-correlation (in the signal-processing sense) ; however, this terminology is not used in probability and statistics. In contrast, the convolution (equivalent to the cross-correlation of and ) gives the probability density function of the sum .

Cross-correlation of deterministic signals

[edit]

For continuous functions and , the cross-correlation is defined as:[1][2][3]which is equivalent towhere denotes the complex conjugate of , and is called displacement or lag.

For highly-correlated and which have a maximum cross-correlation at a particular , a feature in at also occurs later in at , hence could be described to lag by .

If and are both continuous periodic functions of period , the integration from to is replaced by integration over any interval of length :which is equivalent toSimilarly, for discrete functions, the cross-correlation is defined as:[4][5]which is equivalent to:For finite discrete functions , the (circular) cross-correlation is defined as:[6]which is equivalent to:For finite discrete functions , , the kernel cross-correlation is defined as:[7]where is a vector of kernel functions and is an affine transform.

Specifically, can be circular translation transform, rotation transform, or scale transform, etc. The kernel cross-correlation extends cross-correlation from linear space to kernel space. Cross-correlation is equivariant to translation; kernel cross-correlation is equivariant to any affine transforms, including translation, rotation, and scale, etc.

Explanation

[edit]

As an example, consider two real valued functions and differing only by an unknown shift along the x-axis. One can use the cross-correlation to find how much must be shifted along the x-axis to make it identical to . The formula essentially slides the function along the x-axis, calculating the integral of their product at each position. When the functions match, the value of is maximized. This is because when peaks (positive areas) are aligned, they make a large contribution to the integral. Similarly, when troughs (negative areas) align, they also make a positive contribution to the integral because the product of two negative numbers is positive.

Animation of how cross-correlation is calculated. The left graph shows a green function G that is phase-shifted relative to function F by a time displacement of 𝜏. The middle graph shows the function F and the phase-shifted G represented together as a Lissajous curve. Integrating F multiplied by the phase-shifted G produces the right graph, the cross-correlation across all values of 𝜏.

With complex-valued functions and , taking the conjugate of ensures that aligned peaks (or aligned troughs) with imaginary components will contribute positively to the integral.

In econometrics, lagged cross-correlation is sometimes referred to as cross-autocorrelation.[8]: p. 74 

Properties

[edit]
  • The cross-correlation of functions and is equivalent to the convolution (denoted by ) of and . That is:
  • If is a Hermitian function, then
  • If both and are Hermitian, then .
  • .
  • Analogous to the convolution theorem, the cross-correlation satisfies
    where denotes the Fourier transform, and an again indicates the complex conjugate of , since . Coupled with fast Fourier transform algorithms, this property is often exploited for the efficient numerical computation of cross-correlations[9] (see circular cross-correlation).
  • The cross-correlation is related to the spectral density (see Wiener–Khinchin theorem).
  • The cross-correlation of a convolution of and with a function is the convolution of the cross-correlation of and with the kernel :
    .

Cross-correlation of random vectors

[edit]

Definition

[edit]

For random vectors and , each containing random elements whose expected value and variance exist, the cross-correlation matrix of and is defined by[10]: p.337 and has dimensions . Written component-wise:The random vectors and need not have the same dimension, and either might be a scalar value. Where is the expectation value.

Example

[edit]

For example, if and are random vectors, then is a matrix whose -th entry is .

Definition for complex random vectors

[edit]

If and are complex random vectors, each containing random variables whose expected value and variance exist, the cross-correlation matrix of and is defined bywhere denotes Hermitian transposition.

Cross-correlation of stochastic processes

[edit]

In time series analysis and statistics, the cross-correlation of a pair of random process is the correlation between values of the processes at different times, as a function of the two times. Let be a pair of random processes, and be any point in time ( may be an integer for a discrete-time process or a real number for a continuous-time process). Then is the value (or realization) produced by a given run of the process at time .

Cross-correlation function

[edit]

Suppose that the process has means and and variances and at time , for each . Then the definition of the cross-correlation between times and is[10]: p.392 where is the expected value operator. Note that this expression may be not defined.

Cross-covariance function

[edit]

Subtracting the mean before multiplication yields the cross-covariance between times and :[10]: p.392 Note that this expression is not well-defined for all time series or processes, because the mean or variance may not exist.

Definition for wide-sense stationary stochastic process

[edit]

Let represent a pair of stochastic processes that are jointly wide-sense stationary. Then the cross-covariance function and the cross-correlation function are given as follows.

Cross-correlation function

[edit]

or equivalently

Cross-covariance function

[edit]

or equivalently where and are the mean and standard deviation of the process , which are constant over time due to stationarity; and similarly for , respectively. indicates the expected value. That the cross-covariance and cross-correlation are independent of is precisely the additional information (beyond being individually wide-sense stationary) conveyed by the requirement that are jointly wide-sense stationary.

The cross-correlation of a pair of jointly wide sense stationary stochastic processes can be estimated by averaging the product of samples measured from one process and samples measured from the other (and its time shifts). The samples included in the average can be an arbitrary subset of all the samples in the signal (e.g., samples within a finite time window or a sub-sampling[which?] of one of the signals). For a large number of samples, the average converges to the true cross-correlation.

Normalization

[edit]

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

The definition of the normalized cross-correlation of a stochastic process isIf the function is well-defined, its value must lie in the range , with 1 indicating perfect correlation and −1 indicating perfect anti-correlation.

For jointly wide-sense stationary stochastic processes, the definition isThe 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

[edit]

Symmetry property

[edit]

For jointly wide-sense stationary stochastic processes, the cross-correlation function has the following symmetry property:[11]: p.173 Respectively for jointly WSS processes:

Time delay analysis

[edit]

Cross-correlations are useful for determining the time delay between two signals, e.g., for determining time delays for the propagation of acoustic signals across a microphone array.[12][13][clarification needed] After calculating the cross-correlation between the two signals, the maximum (or minimum if the signals are negatively correlated) of the cross-correlation function indicates the point in time where the signals are best aligned; i.e., the time delay between the two signals is determined by the argument of the maximum, or arg max of the cross-correlation, as inTerminology in image processing

Zero-normalized cross-correlation (ZNCC)

[edit]

For image-processing applications in which the brightness of the image and template can vary due to lighting and exposure conditions, the images can be first normalized. This is typically done at every step by subtracting the mean and dividing by the standard deviation. That is, the cross-correlation of a template with a subimage is

where is the number of pixels in and , is the average of and is standard deviation of .

In functional analysis terms, this can be thought of as the dot product of two normalized vectors. That is, ifandthen the above sum is equal towhere is the inner product and is the L² norm. Cauchy–Schwarz then implies that ZNCC has a range of .

Thus, if and are real matrices, their normalized cross-correlation equals the cosine of the angle between the unit vectors and , being thus if and only if equals multiplied by a positive scalar.

Normalized correlation is one of the methods used for template matching, a process used for finding instances of a pattern or object within an image. It is also the 2-dimensional version of Pearson product-moment correlation coefficient.

Normalized cross-correlation (NCC)

[edit]

NCC is similar to ZNCC with the only difference of not subtracting the local mean value of intensities:

Nonlinear systems

[edit]

Caution must be applied when using cross correlation function which assumes Gaussian variance for nonlinear systems. In certain circumstances, which depend on the properties of the input, cross correlation between the input and output of a system with nonlinear dynamics can be completely blind to certain nonlinear effects.[14] This problem arises because some quadratic moments can equal zero and this can incorrectly suggest that there is little "correlation" (in the sense of statistical dependence) between two signals, when in fact the two signals are strongly related by nonlinear dynamics.

See also

[edit]

References

[edit]

Further reading

[edit]
[edit]
Revisions and contributorsEdit on WikipediaRead on Wikipedia
from Grokipedia
Cross-correlation is a fundamental concept in statistics and that measures the degree of similarity between two signals or as a function of the temporal displacement, or lag, between them. For two continuous-time signals f(t)f(t) and g(t)g(t), the cross-correlation function is mathematically defined as (fg)(τ)=f(t)g(t+τ)dt(f \star g)(\tau) = \int_{-\infty}^{\infty} f^*(t) g(t + \tau) \, dt, where ^* denotes the and τ\tau represents the lag; this formulation generalizes to discrete-time signals as nf(n)g(n+l)\sum_n f^*(n) g(n + l) for lags ll. Unlike , which assesses a signal's similarity to itself, cross-correlation evaluates relationships between distinct signals, providing insights into their statistical dependencies without assuming commutativity. In , cross-correlation serves as an estimator for stationary processes, often computed via the for efficiency, yielding the cross-spectral density as R^xy(ωk)=X(ωk)Y(ωk)N\hat{R}_{xy}(\omega_k) = \frac{\overline{X(\omega_k)} Y(\omega_k)}{N}. It is essential for tasks such as detecting periodicities, aligning signals, and filtering noise, with applications extending to fields like where it helps identify echoes or delays. In statistics, particularly , the sample cross-correlation function (CCF) quantifies lagged linear associations between variables, aiding in model identification for processes like . Cross-correlation also plays a key role in for characterizing interactions between neural spike trains, such as computing spike-triggered averages to infer stimulus-response relationships, and in physics for analyzing correlations in experimental data. Its origins trace back to early 20th-century statistical theory, with significant advancements by in the 1940s through his work on stochastic processes and filtering, which formalized its use in . Modern implementations, such as MATLAB's xcorr function, facilitate its computation for practical research across disciplines.

Deterministic Signals

Definition

Cross-correlation measures the similarity between two deterministic signals as a function of the displacement of one relative to the other. For continuous-time complex-valued signals f(t)f(t) and g(t)g(t), the cross-correlation function is defined mathematically as (fg)(τ)=f(t)g(t+τ)dt,(f \star g)(\tau) = \int_{-\infty}^{\infty} f^*(t) \, g(t + \tau) \, dt, where f(t)f^*(t) denotes the complex conjugate of f(t)f(t). This formulation generalizes the case for real-valued signals by omitting the conjugate. The corresponding definition for discrete-time signals ff and gg is (fg)=m=fg[m+n].(f \star g) = \sum_{m=-\infty}^{\infty} f^* \, g[m + n]. These expressions compute the integral or sum over all time, yielding the degree of overlap or alignment between the signals at lag τ\tau or nn. Intuitively, the cross-correlation arises from the inner product in the space of signals, where one signal is shifted relative to the other; the magnitude indicates similarity, with the lag corresponding to the shift that maximizes alignment. Cross-correlation originated in in the early for in time series analysis. As a special case, when f=gf = g, the cross-correlation reduces to the function.

Properties

The cross-correlation operation for deterministic signals exhibits in each argument. Specifically, for scalar constants aa and bb, and signals f1f_1, f2f_2, and gg, it holds that (af1+bf2)g=a(f1g)+b(f2g)(a f_1 + b f_2) \star g = a (f_1 \star g) + b (f_2 \star g), and analogously for the second argument: f(ag1+bg2)=a(fg1)+b(fg2)f \star (a g_1 + b g_2) = a (f \star g_1) + b (f \star g_2). This follows from the linearity of the underlying or defining the cross-correlation. For complex-valued signals, the cross-correlation satisfies conjugation symmetry: (fg)(τ)=[(gf)(τ)](f \star g)(\tau) = [(g \star f)(-\tau)]^*, where ^* denotes the complex conjugate. This property arises from the definition of cross-correlation as an inner product-like measure and ensures consistency in measuring similarity between complex signals. The cross-correlation is closely related to the Fourier transform. If F{f}\mathcal{F}\{f\} and F{g}\mathcal{F}\{g\} denote the Fourier transforms of ff and gg, respectively, then the Fourier transform of the cross-correlation is given by F{fg}=F{f}F{g}\mathcal{F}\{f \star g\} = \mathcal{F}\{f\}^* \cdot \mathcal{F}\{g\}, where \cdot indicates pointwise multiplication. Consequently, the cross-correlation itself can be computed as the inverse Fourier transform: (f \star g = \mathcal{F}^{-1} {\mathcal{F}{f}^* \cdot \mathcal{F}{g}}$. This frequency-domain representation facilitates efficient computation via the fast Fourier transform algorithm. A shift theorem applies to the cross-correlation. If one signal is a time-shifted version of the other, say g(t)=f(tT)g(t) = f(t - T), then the cross-correlation (fg)(τ)(f \star g)(\tau) achieves its maximum value at τ=T\tau = T, with the shape of the shifting accordingly to reflect the delay. In general, time shifts in the input signals translate directly to shifts in the output cross-correlation function. For identical signals, f=gf = g, the cross-correlation (ff)(τ)(f \star f)(\tau) reaches its maximum at τ=0\tau = 0, where the value equals the energy of the signal, f(t)2dt\int |f(t)|^2 dt, quantifying the maximum overlap between the signal and itself. This peak at zero lag serves as a measure of the signal's and total content.

Random Variables and Vectors

Scalar Random Variables

The cross-correlation between two scalar random variables XX and YY (possibly complex-valued) is defined as ρXY=E[XY]\rho_{XY} = E[XY^*], where E[]E[\cdot] denotes the statistical expectation and ^* the . This quantity represents the of the product XYXY^*, serving as a fundamental measure of their joint statistical behavior in and . In contrast to cross-covariance, which centers the variables by subtracting their means and is given by E[(XμX)(YμY)]E[(X - \mu_X)(Y - \mu_Y)^*] with μX=E[X]\mu_X = E[X] and μY=E[Y]\mu_Y = E[Y], the cross-correlation ρXY\rho_{XY} incorporates these means directly, yielding ρXY=E[(XμX)(YμY)]+μXμY\rho_{XY} = E[(X - \mu_X)(Y - \mu_Y)^*] + \mu_X \mu_Y^*. This inclusion makes cross-correlation sensitive to both linear relationships and location shifts in the distributions. For jointly Gaussian random variables, ρXY\rho_{XY} can be computed explicitly via the joint (PDF). The bivariate Gaussian joint PDF is fXY(x,y)=12πσXσY1γ2exp(12(1γ2)[(xμX)2σX2+(yμY)2σY22γ(xμX)(yμY)σXσY]),f_{XY}(x,y) = \frac{1}{2\pi \sigma_X \sigma_Y \sqrt{1 - \gamma^2}} \exp\left( -\frac{1}{2(1 - \gamma^2)} \left[ \frac{(x - \mu_X)^2}{\sigma_X^2} + \frac{(y - \mu_Y)^2}{\sigma_Y^2} - \frac{2\gamma (x - \mu_X)(y - \mu_Y)}{\sigma_X \sigma_Y} \right] \right),
Add your contribution
Related Hubs
User Avatar
No comments yet.