Lably
Skip to content

Cross-correlation

Covariance and correlation

  • 8 min read
  • 6 chapters

Related on Lably

Through Dot product, Pattern recognition and Average

In probability and statistics, the term cross-correlations refers to the correlations between the entries of two random vectors X and Y, while the correlations of a random vector X are the correlations between the entries of X itself, those forming the correlation matrix of X. If each of X and Y is a scalar random variable which is realized repeatedly in a time series, then the correlations of the various temporal instances of X are known as autocorrelations of X, and the cross-correlations of X with Y 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 X and Y are two independent random variables with probability density functions f and g, respectively, then the probability density of the difference Y−X is formally given by the cross-correlation (in the signal-processing sense) f⋆g; however, this terminology is not used in probability and statistics. In contrast, the convolution f∗g (equivalent to the cross-correlation of f(−t)¯ and g(t)) gives the probability density function of the sum X+Y.

Cross-correlation of deterministic signals

For continuous functions f and g, the cross-correlation is defined as:(f⋆g)(τ)≜∫−∞∞f(t)¯g(t+τ)dtwhich is equivalent to(f⋆g)(τ)≜∫−∞∞f(t−τ)¯g(t)dtwhere f(t)¯ denotes the complex conjugate of f(t), and τ is called displacement or lag.

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

If f and g are both continuous periodic functions of period T, the integration from −∞ to ∞ is replaced by integration over any interval [t0,t0+T] of length T:(f⋆g)(τ)≜∫t0t0+Tf(t)¯g(t+τ)dtwhich is equivalent to(f⋆g)(τ)≜∫t0t0+Tf(t−τ)¯g(t)dtSimilarly, for discrete functions, the cross-correlation is defined as:(f⋆g)[n]≜∑m=−∞∞f[m]¯g[m+n]which is equivalent to:(f⋆g)[n]≜∑m=−∞∞f[m−n]¯g[m]For finite discrete functions f,g∈CN, the (circular) cross-correlation is defined as:(f⋆g)[n]≜∑m=0N−1f[m]¯g[(m+n)modN]which is equivalent to:(f⋆g)[n]≜∑m=0N−1f[(m−n)modN]¯g[m]For finite discrete functions f∈CN, g∈CM, the kernel cross-correlation is defined as:(f⋆g)[n]≜∑m=0N−1f[m]¯Kg[(m+n)modN]where Kg=[k(g,T0(g)),k(g,T1(g)),…,k(g,TN−1(g))] is a vector of kernel functions k(⋅,⋅):CM×CM→R and Ti(⋅):CM→CM is an affine transform.

Specifically, Ti(⋅) 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

As an example, consider two real valued functions f and g differing only by an unknown shift along the x-axis. One can use the cross-correlation to find how much g must be shifted along the x-axis to make it identical to f. The formula essentially slides the g function along the x-axis, calculating the integral of their product at each position. When the functions match, the value of (f⋆g) 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.

With complex-valued functions f and g, taking the conjugate of f 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.

Properties

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

Sign in to keep reading

5 more chapters are free with a Lably account.

More in Statistics