4
$\begingroup$

I have a time series data with its ACF shown below. The time unit is day(s). enter image description here

What looks intriguing for me is that there seems to be a peaks at every 7 or 8 lags, and it looks like there is a seasonal trend but the trend diminishes as lags increase. I use auto.arima() to select the best-fit ARIMA process according to information criteria, and below is an ACF of the residuals of a model with ARIMA(2,0,1) with non-zero mean:

enter image description here

While the pattern is weaker after ARIMA(2,0,1), it is still discernable and I wonder what would be the best way to model this trend. I have tried to use dummies to address seasonality such as:

Week days

data$wday <- wday(dataset$time)
season <- lm(data$variable ~ factor(data$wday))
pacf(season$residuals)

Month

data$month <- month(data$time)
season <- lm(data$variable ~ factor(data$month))
pacf(season$residuals)

Quarters

data$quarter <- quarter(data$time)
season <- lm(data$variable ~ factor(data$quarter))
pacf(season$residuals)

But the pattern is still quite discernable in all cases.

For time series practitioners on the forum, are there other ways that you would use to model this data? The ARIMA(2,0,1) passes the Box.test. But I am just not feeling satisfied as it looks like something associated with time is still going on in the residual ACF.

Attachment: here is a link to a sample csv file.

$\endgroup$
  • 1
    $\begingroup$ Have you specified your time series frequency as 7 before feeding it into auto.arima? Also, why do you say diminishing seasonality in the title but do not refer to that in the body? $\endgroup$ – Richard Hardy Mar 8 '17 at 7:41
  • $\begingroup$ Hi Richard, thanks! I have just did the frequency = 7 specification, the auto.arima suggests a ARIMA(3,0,3) and ACF() indeed becomes flatter. Is this how you would address the pattern issue? I did not emphasize "diminishing seasonality" in the text because while I think there is indeed a clear pattern, I am not sure whether this is the right way to describe (could be just a way seasonality shows?) I have add more descriptions now. $\endgroup$ – carl_pch Mar 8 '17 at 20:32
  • 1
    $\begingroup$ You could also include the information in the comment as an edit of the text. That makes it easier for anyone reading it for the first time. Regarding diminishing seasonality, there is a difference between (1) ACF getting closer to zero when lag increases and (2) seasonality becoming less pronounced over time (data generating process gradually changing). I read your title as the latter, but you seem to have in mind the former. But the former is pretty natural and happens all the time. $\endgroup$ – Richard Hardy Mar 8 '17 at 20:41
  • $\begingroup$ Regarding the answer by IrishStat, we should get some facts straight: auto.arima does just fine in real-world applications, which is proven by its track record on, say, the M competitions data. Meanwhile, the public evidence on Autobox vs. auto.arima shows that Autobox does worse (see here). So as someone said, "In God we trust; all else bring data". $\endgroup$ – Richard Hardy Mar 9 '17 at 18:57
  • 1
    $\begingroup$ The decreasing peaks in your ACF don't mean that the trend is decreasing over time. It means that the correlation becomes weaker as time increases, which is reasonable in the real world. $\endgroup$ – Wayne Mar 10 '17 at 12:36
2
$\begingroup$

When you use a drug (or a piece of software like auto.arima you should read the warnings on the label ... for example auto.arima based upon my experience is very suspect when dealing with real world data that has outliers/anomalies or level shifts or deterministic time trends. Here is a plot of your data enter image description here . An additional warning is don't use if you have lots and lots of zeroes enter image description here . An additional warning is that it is assumed that there are no fixed effects like days-of-the-week , weeks of the month or monthly effects or Holiday Effects . Your data appears to have both monthly effects and Holiday Effects and a possibly spurious one-day-of-the-month effect .enter image description here

New inexperienced time series analysts often with an econometric training usually know nothing or very little of these things (assumptions). You inadvertently are using the wrong analytical (although free) software in my opinion. Here is the model summary taking into account memory (non-existent) , monthly effects , holiday effects , one particular day of the month) and anomalies is here .

In closing one might carefully look at https://www.quora.com/What-are-some-skills-nuances-that-software-engineer-turned-data-scientists-lack-that-statisticians-ML-PHDs-possess/answer/Daniel-Tunkelang?ref=fb_page .

The whole idea here is to educate new and old users on the complexities of real-world time series analysis and to shed light on solutions that may not be general enough to be routinely used. My experience tells me (withou seeing your coefficients) that your (3,0,3) or (2,0,1) are just artifacts of fitting versus modelling and most probably has self-cancelling structure i.e. redundant ARMA structure .

In response to @Whuber's excellent question , asking for details (always a good idea !):

@whuber Identification of daily seasonality is accomplished in two possible ways 1) by examining the ACF /PACF for significant structure (ARIMA seasonality) at lags 7.14 etc. or 2) by attempting to incorporate 6 seasonal /fixed dummies representing days-of-the-week . Neither was found to be useful /significant in this case. In terms of Monthly seasonality this was detected by simple trial and error, i.e. setting up the 11 monthly indicators and doing a step-down. The Holiday seasonal factors (lead, contemporaneous and lag) were also found via a heuristic data-based search process yielding two holiday/seasonal variables Christmas and Mardi Gras) . The day 14 effect was also found by a search/trial and error approach. Thus FOUR distinctly different "seasonal factors" were evaluated with only the ARIMA seasonality totally rejected. auto.arima in my experience only tries to find ARIMA seasonality by a list-based trial and error rather than a data-based trial and error.

enter image description here

$\endgroup$
  • 1
    $\begingroup$ Thanks a lot for conducting additional analysis on the data! I agree with what you said and thanks for pointing out that there might be issue when there are predominantly 0 in a time series. I think the problem is still unsolved because further guidance is needed for going beyond (3,0,3) and (2,0,1) to addressing the monthly and holiday effects you mentioned at the same time. It is not yet clear to me how to do it in R. Is it something only Autobox is able to do? Thanks again for the detailed response. $\endgroup$ – carl_pch Mar 9 '17 at 15:15
  • 3
    $\begingroup$ With your negative emphases on "inexperienced," "nonsense," "warnings," "inadvertently," and "spurious" it seems to me that you might have crossed a line that separates offering useful advice from ranting, using language that risks gratuitously offending the OP (who has been gracious about it) and many readers. Could you point out where you have explained how to identify seasonality in ACF plots and use that to model data? $\endgroup$ – whuber Mar 9 '17 at 15:16
  • $\begingroup$ @RichardHardy Perhaps you didn't see this I believe that you were referring to a version of AUTOBOX from many, many years ago. AUTOBOX has changed signiifcantly oh these many years. If I am not wrong you only compared accuracies from 1 origin which I am sure you will agree is a sample of 1. Accuracies need to be evaluated from a number of origins. – IrishStat Jul 22 '12 at 0:58 $\endgroup$ – IrishStat Mar 10 '17 at 11:39
  • 1
    $\begingroup$ Sorry, I thought I had deleted the comment. I will delete it now. Please refer to my comment under the OP. On the other hand, recall that we are talking about some 3000 samples of one (for 3000 different time series), not one sample, thus we are evaluating forecasting performance on 3000 data points, which is quite a nice sample size. Also, I look forward to new public comparisons so that the old information could be replaced by new information. (I would love to see a method that works well, regardless of its name!) But so far the best we have is the old information, or is it not? $\endgroup$ – Richard Hardy Mar 10 '17 at 12:36
  • $\begingroup$ in my opinion a one origin forecast is a sample of 1 as compared to accurracies measured for multiple origins for each data set which is far more scientific. The fact that this flawed approach of 1 origin was duplicated 3000 times doesn't make it right just deficient 300 times $\endgroup$ – IrishStat Mar 10 '17 at 13:01

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.