Cross-correlation or cross-covariance of non-zero mean signals
What are reasons to choose for cross-correlation or cross-covariance when comparing signals with non-zero mean?


Well, part of the issue is that cross-correlation as defined in your equation:

$$(f \star g)[n]\ \stackrel{\mathrm{def}}{=} \sum_{m=-\infty}^{\infty} f^*[m]\ g[m+n].$$

will not exist (or be infinite) if $f$ and $g$ have non-zero mean. So, in order to do the calculation, you really should subtract the mean beforehand.

If you're dealing with finite length signals, it's even worse, because you end up with an underlying triangular offset as per the image below.



This shows the sample cross-correlation between two gaussian processes with non-zero mean.  The black line is the sample cross-correlation calculated without subtracting the mean.  The red line is the sample cross-correlation calculated by first subtracting the mean from both signals.


  Does cross-correlation have any significance in this case, because $f\star g$ has mean $\mu_f\mu_g$?


It doesn't generally, unless you're very interested in the mean value.

And, as I said, as per your definition, any value of $\mu_f$ and $\mu_g$ both different from zero will result in an infinite sample cross-correlation.


  How would one find out the cross-correlation of signals that are not WSS, e.g. the mean is a linear trend? What would happen if we'd ignore this linear trend and simply subtract the signal means, then calculate cross-correlation? What if we subtracted the linear trend instead of the mean? What are the consequences for such mild violations of WSS-ity?


When looking at linear trends, it's usual to detrend before looking at the statistics of the variation around the trend. Sometimes doing this allows the variations to be treated as WSS.

If you keep the trend, you'll end up with a sample cross-correlation that looks like a parabola (the integration of a linear trend).  In this case, simply removing the mean doesn't help. See similar plot to first below, this time with two linear trend noisy signals.





Please see this exposition on the Mathworks site for a Matlab version of the above / below.



R Code Only Below

#34778
#install.packages('SynchWave')
require(SynchWave)

with_mean_ccf &lt;- function(f,g)
{
  length &lt;- length(f) + length(g) - 1

  ff &lt;- c(f, rep(0,length - length(f) + 1))
  gg &lt;- c(f, rep(0,length - length(g) + 1))

  FF &lt;- fft(ff)
  GG &lt;- fft(gg)

  ccf &lt;- fft(FF * Conj(GG), inverse = TRUE)

  return(fftshift(Re(ccf)))
}

T &lt;- 1000
mu_f &lt;- 1
mu_g &lt;- 2

f &lt;- rnorm(T,1) + mu_f
g &lt;- rnorm(T,1) + mu_g


with_mean &lt;- with_mean_ccf(f,g)
no_mean &lt;- with_mean_ccf(f-mean(f), g-mean(g))
plot(with_mean)
points(no_mean, col='red')
title('Sample crosscorrelation with (red) and without (black) mean subtraction')


a &lt;- rnorm(T,1) + seq(1,T)/3
b &lt;- rnorm(T,1) + seq(1,T)/2

with_mean_and_trend &lt;- with_mean_ccf(a,b)
no_mean_and_trend &lt;- with_mean_ccf(a-mean(a),b-mean(b))

plot(with_mean_and_trend, ylim=c(min(with_mean_and_trend,no_mean_and_trend), max(with_mean_and_trend,no_mean_and_trend)) )
points(no_mean_and_trend, col="red")
title('Sample cross-correlation of two linear trend signals')