I'd like to detect seasonality in my timeseries which consist of daily observation 96 per day,one for every 15 min, for a duration of 3 months.

enter image description here

enter image description here

In the acf plot, I see a consistent 3 spikes, does that mean that I have monthly seasonality?

enter image description here

This is how pacf looks liks, on xts, I set the frequency to 96 * 365.25, with 96 corresponding to the number of my daily observations

enter image description here

Adding the acf with max lag set to the number of daily observations enter image description here

adding link to dataset, I also like to know how seasonality can be determined so that I can do it on my own


enter link description here

  • 1
    $\begingroup$ I don't think those spikes correspond to months. The ACF is in the time domain, not frequency domain. It's not clear to me what the units are on lag; I'm guessing those are a fraction of a year, but that will depend on how you set the data up. If that guess is right, it's suggesting something going on at or just under 6-hour intervals but I'd want to look at a PACF and be clear what period the data were set up with. If you're considering ARIMA models you'll need some differencing, possibly at both lag 1 and at some cyclical periods. $\endgroup$ – Glen_b -Reinstate Monica Nov 1 '15 at 10:14
  • 1
    $\begingroup$ Looking at the top plot (the plot against time), there's also a daily cycle. There may be others, but your ACF is too short to see anything longer than a few hours. Oh, and there also seems to be a weekly cycle in the time plot. I can't discern any longer cycle from what's there. $\endgroup$ – Glen_b -Reinstate Monica Nov 1 '15 at 10:27
  • $\begingroup$ I added acf with max lag set to the number of daily observation, I have spike every 24, should I conclude that I have a daily seasonality of every 6 hours $\endgroup$ – Sasukethorpido Nov 1 '15 at 10:44
  • $\begingroup$ I don't understand the apparently widespread tendency to look at autocorrelation without looking at plots against time. Seasonality used to mean dependence on time of year; now it seems to be widely blurred to mean any kind of related dependence on time of month, time of week or time of day. It follows, to me. that plotting the data against time of week and time of day is the next diagnostic step. (At most you only have 1/4 of an annual cycle; therefore seasonality is quite likely to appear as, or be conflated with, any trend.) $\endgroup$ – Nick Cox Nov 1 '15 at 10:46
  • $\begingroup$ Why don't you post your data and the readers of this list might respond with their approaches to this all-too familiar problem/opportunity. $\endgroup$ – IrishStat Nov 2 '15 at 0:03

I believe those lags are your data in years. If I understood your data correctly, 0.0015 lag is ~53 15-minute intervals. You need to determine the exact lags for those spikes to identify the right intervals. Say for example, if the spike landed on 0.0015 (~53 15-minute intervals), 0.0020 (~70 15-minute intervals), and 0.0025 (~88 15-minute intervals) it means that your data appears to have a seasonal pattern about 18 15-minute intervals apart or 270 minutes or 4.5 hours.

Say newdata_timeseries is your data frame. You can multiply your lags by 35,040, because there are those many 15 minute intervals in a year.

acf_newdata_timeseries <- acf(newdata_timeseries)
acf_newdata_timeseries`$`lag <- acf_newdata_timeseries`$`lag * 35040
plot(acf_newdata_timeseries, xlab="Lag (15 minute intervals)")

To detect seasonality, I found the Ljung-Box test sufficient in most cases. Its null hypothesis is that all of the autocorrelation functions out of n lags are zero. So, if the p-value is less than 0.05 then you can say that there is seasonality, since data is autocorrelated on some lags.

Box.test(newdata_timeseries,lag=<You can insert here the max number of lags from the plot>,

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.