# Periodicity and seasonality of a time series

I have a time series and I have done some spectral analysis on it.

When doing an autocorrelation and periodogram it shows that the time series is periodic. However when I do a Dickey-Fuller test it shows that the time series is stationary, which brings the question of which method to use to investigate periodicity and seasonality of a time series.

I think (I am not really a time series expert) that the first question to ask is if the time series is autoregressive or not. So the question is, is there a way to find if my time series is autoregressive and if not which methods to use to check the periodicity and seasonality? For example, on of my datasets shows the current patterns in acf graph and periodogram  The periodogram shows a high value in frequence 0.01234375 which is approximatly 81 time period and I can't figure out the saisonality here.

• ACF and PACF are not helpful for your data, they either show some kind of complicated ARMA lag structure, or large (relatively) number of lags. What is the nature of series? What's time scale? – Aksakal Jan 21 '16 at 2:00
• this is a vehicle arrival time series and the time scale is a second. – Saad Touhbi Jan 21 '16 at 4:40
• Did you look at arrival time processes? They are related to poisson and exponential distributions. – Aksakal Jan 21 '16 at 13:12
• Yea I am just looking for other caracterisitques of the arrival time. – Saad Touhbi Jan 26 '16 at 10:10

Periodic data will be stationary from Dickey-Fuller perspective as long as the mean is stable, i.e. there's no trend of some sort. For instance, consider this code in MATLAB:

x=1:100;
plot(x,sin(x))


The output:

h =

1

p =

1.0000e-03 So, ADF test rejects the unit root, i.e. thinks it's stationary. I'd agree with it.

So, no, you can't use ADF test to sense the periodicity.

I usually start with ACF and PACF plots. Google the terms, e.g. this link would show up that demonstrates how to use these things to identify p and q in ARMA(p,q) models.

You could use spectral analysis techniques, such as Fourier decomposition and periodograms. These usually work better with very long samples, like those in signal processing and physics. Actually, they're designed for infinite series. Hence, usual techniques such as FFT do not work very well for economic and financial data (unless it's high frequency trading or such). Hence, there are ways to extract the periodograms using AR modeling, e.g. Yule-Walker equations. These things are all standard tool in any stat package such as SAS.

Now that we got this stuff out of the way, let's answer your question about periodicity and autoregression directly. So, yes, they're related through Yule-Walker equations, as I wrote earlier. Here's the motivating example: $$y_t=-y_{t-10}+\varepsilon_t$$, where $\varepsilon\sim\mathcal{N}(0,1)$ Here's an example of the path generated by this process in MATLAB.

y=randn(10,1);
for i=11:1000; y(i)=-y(i-10)+randn;end
subplot(2,1,1)
plot(y)
subplot(2,1,2)
periodogram(y) You can see here how the periodogram is catching the 0.1 Hz frequency, it means that the period length is 10 observations. You also see a bunch of overtones. This process is non-stationary in variance: it's growing at rate of speed $\sqrt t$, yet the periodogram is still catching the rhythm.

• Your answer does not seem to address the question(s) in the OP (but I appreciate the illustration). – Richard Hardy Jan 20 '16 at 14:15
• @RichardHardy, fair comment. I added a paragraph with methods. – Aksakal Jan 20 '16 at 15:15

In order to check if your time series is stationary, I recommend Dickey-Fuller and KPSS tests. In your case, the series clearly exhibits autocorrelation, so you should could use an Augmented Dickey-Fuller test (ADF). It will model the seasonality and test against a unit root (aka nonstationarity). Make sure that you do use the ADF, not the regular DF. In your case, periodicities are clearly present, and the DF distribution will not give you the right critical values. If you want to be on the safe side, you can additionally perform a KPSS test (which, unlike DF-type of tests takes the null hypothesis to be stationarity and tests against a unit root).

• Your answer does not address the question "which method to use to investigate periodicity and seasonality of a time series", hence it does not suit as an answer. Also, "it will model the seasonality" – that is not true. Also, does KPSS test have an explicit alternative hypothesis? Usually statistical tests have explicit null hypotheses but may be applied against a variety of alternatives, which fall in the general category "the null is not true". (However, the ADF test has the stationary case rather than the explosive case as its alternative, so there are counterexamples.) – Richard Hardy Jan 20 '16 at 14:12
• ADF will not catch seasonality, see my example. It will only catch something if you have half a period sample or something unusual like that by chance. – Aksakal Jan 20 '16 at 15:15