Although I've read many assertions and claims that seasonality or trends are indicators that a time series is not stationary, I don't quite understand why. In fact, I have a construction of what I think is a stationary process with a period / trend in it.

Thus, time series with trends, or with seasonality, are not stationary — the trend and seasonality will affect the value of the time series at different times.

-- Forecasting: Principles and Practice from Rob J Hyndman and George Athanasopoulos

Consider a periodic function $g$ with period $P$. If $y$ is uniformly distributed from $0$ to $P$, and $\epsilon_t$ is white noise, then $X_t = g(t+y)+\epsilon_t$ is stationary, because if you're given some time $t$, there's no way of knowing where exactly in the season you are placed. But any particular realization of the process would definitely exhibit "seasonality".

To be a bit more rigorous, $E[g(t+y)] = \frac{1}{P} \int_0^P g(t+y) dy = \frac{1}{P} \int_t^{t+P} g(u) du$. By periodicity of $g$, this is the same as $\frac{1}{P}\int_0^P g(u) du$, which doesn't depend on $t$. so $E[X_t]$ is constant. The same argument can be used to show that the variance and autocovariances are also constant -- simply drop in $g(t+y)^2$ or $g(t+y)g(t+y+k)$ in place of $g(t+y)$.

As another example, consider a function $f(t)$ drawn from a suitable prior -- for example, a standard gaussian process. Then $X_t = f(t)+ \epsilon_t$ is also stationary, despite the fact that $f$ is very definitely a trend. (At least, if a gaussian kernel is used, and the lengthscale is large compared to the observed time series, it's possible or even likely that a consistent downward or upward trend will be present throughout the entire observed data).

Again, to be a bit more precise, for a standard gaussian process with gaussian kernel, the expectation is 0 everywhere and since the gaussian kernel $K(x, x')$ depends on only the difference $x-x'$, the covariance is also shift-invariant.

For a fixed $y$ or a fixed $f(t)$, these examples would obviously not be stationary, but I don't see any reason why they should be fixed.

The crux of my confusion seems to stem from the fact that while stationarity requires the joint distribution to remain invariant to shifts, typically the "time series data" consists of just a single instance or sample of the process -- from which it seems impossible to conclude anything about the distribution.

Am I misunderstanding something here?

  • $\begingroup$ Wouldn't the mean and possibly variance change during the season, which is what non-stationarity involves. A mean or variance that changes over time. $\endgroup$
    – user54285
    Aug 28, 2020 at 21:46
  • $\begingroup$ @user54285 $E[g(t+y)] = \frac{1}{P} \int_0^P g(t+y) dy = \frac{1}{P} \int_t^{t+P} g(u) du$. But by construction ($g$ is periodic with period $P$), so this is the same as $\frac{1}{P}\int_0^P g(u) du$, which doesn't depend on $t$. so $E[X_t]$ is constant. $\endgroup$
    – shimao
    Aug 29, 2020 at 3:22

1 Answer 1


I would probably consider this to be a comment, but I don't have enough reputation to add it.

I believe that your question can be answered in terms of the difference between stationarity and ergodicity of a particular realisation of the stochastic process. In the book by Hamilton (Time series Analysis) you can find an example of a stationary process that is not ergodic that basically goes as follows:

Consider the mean of the ith realisation of a stochastic process $\{Y^{(i)}_t\}_{t=-\infty}^{t=\infty}$ to be $\mu^{(i)}$, generated by a $\mathcal{N}(0, \lambda^2)$ distribution: $Y^{(i)}_t = \mu^{(i)} +\epsilon_t$, being $\epsilon_t$ (Gaussian) white noise with variance $\sigma^2$. Under these assumptions one can show that the process is covariance-stationary. In particular, the mean $\mathbb{E}[Y_t] = \mathbb{E}[\mu^{(i)}] + \mathbb{E}[\epsilon_t] =0$ does not depend on time. However, the i-th realisation is not mean-ergodic because the time average $ \lim_{T\rightarrow \infty} 1/T \sum^T_{i=0}Y^{(i)}_t = \mu^{(i)}$ does not converge to the mean of the process, i.e. to $0$.

To me, your examples seem to be a sophisticated version of the above.

  • $\begingroup$ thanks -- i do agree that my constructions are not ergodic. so i suppose ergodicity is some sort of unspoken but ubiquitous assumption which appears everywhere, and claims that "correcting for seasonality" or "detrending" improves stationarity is assuming ergodicity as well. this seems more or less reasonable, as to reject ergodicity would leave you in some sort of epistemic crisis, akin to rejecting inductive reasoning $\endgroup$
    – shimao
    Aug 29, 2020 at 23:57
  • $\begingroup$ @shimao. If you trace the development of time series to its communications-engineering roots, in particular, the work of Norbert Wiener, and also Claude Shannon, you will notice that the progenitors of these techniques viewed time-series from a statistical mechanics perspective i.e. ergodicity, ensembles, almost everywhere equivalence of time and space averages. I am no expert on time series, having been exposed to it via econometrics. but what I noticed is that modern applied treatments (Hamilton, Brockwell & Davis) have de-contextualised these overtones in favour of a focus on stationarity. $\endgroup$
    – microhaus
    Jul 10, 2021 at 15:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.