How to test if error has zero mean? I know how to calculate the mean of a data set. In DSP, I think zero-mean should means that the error fluctuates around zero, and the mean of errors at any interval is zero. So what about the error in the picture that I show below? The noise in the picture doesn't look like a zero-mean error at all. But the overall mean of all the error values is zero (near zero). How do I mathematically say that the error in the picture is not zero-mean? Usually, which statistical tool is used for testing if a error has zero-mean?

(I think my problem related to the interval at which the mean is calculated. With the error I show in the figure, the overall mean is zero, but the mean at smaller interval is not zero. But I don't know if the official definition about zero-mean care about such thing.)

Edit: to be more correct, I'm asking about zero-mean error, not noise. The figure I show below is the error of my measurement (only error, not include the true value). The error is not stationary, not ergodic. The mean and variance of error change over time but following a repetitive patterns. However, the mean of error over a long period is near zero.
Once you remove the systematic error (or trend) you want to test whether the process is zero mean or not. In hypotheses testing this would assume the following formulation:

$H_1: \quad x[n] = \theta + w[n], \quad n=0, \dots, N-1$, 

$H_0: \quad x[n] = w[n], \quad n=0, \dots, N-1$,

where $w[n] \overset{i.i.d}{\sim} N\left ( 0, \sigma^2 \right )$, $\sigma^2$ is an unknown nuisance deterministic parameter and $\theta$ is another deterministic parameter that bares information on determining which hypothesis we choose.

We will develop a generalized Likelihood Ratio Test (GLRT) for this problem. In the GLRT framework the unknown deterministic parameters are estimated using maximum likelihood criterion, i.e.:


$\quad \widehat{\theta}_{ML} = \frac{1}{N}\sum\limits_{n=0}^{N-1} x[n]$, is the sample mean.
$\widehat{\sigma}^2_{ML} = \frac{1}{N} \sum\limits_{n=0}^{N-1} \left ( x[n] - \widehat{\theta}_{ML}  \right )^2$ is the sample variance under $H_1$, and,
$\widehat{\sigma}^2_{ML} = \frac{1}{N} \sum\limits_{n=0}^{N-1}  x^2[n]$, under $H_0$.


After some algebra dividing the two likelihood functions we get the following test:

\begin{equation}
Z = \frac{\widehat{\theta}_{ML}^2}{\hat{\sigma}^2_{ML}|H_0} = \frac{\left (  \frac{1}{N}\sum\limits_{n=0}^{N-1} x[n]\right )^2}{\frac{1}{N} \sum\limits_{n=0}^{N-1}  x^2[n]} \overset{\underset{&gt;}{H_1}}{\underset{H_0}{&lt;}} \gamma,
\end{equation}

where $\gamma$ is determined by the Neyman-Pearson's theorem given a desired probability of false alarm $P_{FA}$.