I am trying to do time series analysis in R (I am new to the concepts). So first I tried t generate my own synthetic data and check if I am well using the functions in R.

I generated a time series data by only taking white Gaussian noise, I took about 100 points. This time series should be stationary, however when I computed the mean and the variance for the first 50 points it is not equal the mean of the second 50 points, doesn't that contradicts the fact that our series is stationary ?

  • 2
    $\begingroup$ Try taking 10,000 points and the sample means will probably be much closer. $\endgroup$ – Matt P Apr 9 '19 at 14:39
  • $\begingroup$ Thank you for your comment @MattP ,so in genenral I cannot rely on the computation of teh mean to check whether my series is stationary or not ? $\endgroup$ – Nizar Apr 9 '19 at 14:42
  • 1
    $\begingroup$ You can, but you need to take into account statistical significance. With small sample sizes you can have a large insignificant difference. $\endgroup$ – Matt P Apr 9 '19 at 14:53
  • 2
    $\begingroup$ The important point here is to make the distinction between what is a population statement and what is a sample one. From the theory, you know that weak stationarity will imply constant mean and variance, by necessity. You simulated your data, so of course, the sample estimates will be numerically different but that does not imply the process is not weakly stationary. If you wanted to convince yourself solely on a simulation experiment, replicate that experiment, say, a thousand times and you will see how things stabilize. $\endgroup$ – MauOlivares Apr 9 '19 at 16:22

This does not necessarily contradict the notion that your series is stationary. However, while taking more points will help equalize the means of your samples, it also does not ensure stationarity. There exist common tests for determining whether a series is stationary (to some certainty). A popular one is the Augmented Dickey-Fuller test (ADF). I would read more online about these methods but, in general, taking sample means from a time series is not a good way to ensure time-invariant expectations or stationarity. I hope that helps.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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