# Is it possible to take the mean of a time series when it is not stationary?

Many guides, when determining the mean of a time series $$X_{t}$$, assumes that $$X_{t}$$ must be stationary before calculating $$\hat{\mu}=\frac{1}{T}\sum_{i=1}^{T} x_{i}$$.

But consider the following example: I want to get the mean number of daily COVID cases over the last year. Assume $$X_{t}$$ is a process chronicling daily covid cases for a year and that $$X_{t} \sim N(\mu,\sigma^{2})$$. (This distribution is probably incorrect in the real world, but stay with me for this example).

If modeled this way, $$\mu$$ may vary from month to month depending on regulations and world events. Using differencing, $$X_t$$ cannot be converted to a stationary process, so I cannot follow the methods outlined in textbooks like here.

But at the end of the day, I just want the mean number of covid cases in a year. Is it really so bad to just get the sample mean $$\bar{x}$$ and report that? I feel like I may be getting conceptually confused here, so could use some guidance on where I may be misunderstanding the problem.

• "This distribution is probably incorrect" No, the word "totally" is not spelled P R O B A B L Y. ;) Commented Aug 8, 2021 at 19:36

I think you are operating under some faulty assumptions here. Regardless of stationarity, it is always possible to compute the sample mean of a set of data, and if you only want to know this sample mean then there is no inference problem to begin with. Stationarity of the time-series only becomes an issue when you want to use the sample mean or other statistics to help you make inferences about some broader unknown aspect of the series (e.g., its long-term mean, trend, etc.). In this latter case, non-stationarity causes difficulties with the inference, but if you just want to know the sample mean over the observation period then there is no inference problem at all.

(Also, your notation for the sample mean is unusual here. The sample mean here would be denoted as $$\bar{x}_T = \tfrac{1}{T} \sum_{i=1}^T x_i$$. We only use the notation $$\hat{\mu}$$ when we are using the sample mean as an estimator of a parameter $$\mu$$, which is apparently not what you want to do.)

• It might be worth adding a couple words on ergodicity here: "A stochastic process is ergodic for the mean if the time average is a consistent estimator of the mean of the process". As I understand it we routinely assume it but have no way of testing it. Commented Aug 26, 2021 at 23:52