Motivation: I was hired as an intern a few weeks ago to figure out if my company needed to buy new machines six months in advance. Database machines take up to 4 months to install and there is a 2 month grace period.

I signed an NDA, so I don't think I can give any actual data.

The only reliable information I have now, is information on the number of logins and registrations for an education company from 2002 to 2011. I think I can get more recent information on registrations, and people are working on getting login information. We stopped logging login information in 2011 so there will be a gap of no data when I try to forecast :(

The information is collected daily.

I've created a time series forecast of the data using R. I used this tutorial http://a-little-book-of-r-for-time-series.readthedocs.org/en/latest/src/timeseries.html#arima-models To make a holt winters exponential model with daily frequency (frequency = 365). I've removed February 29 from the data. Unfortunately the gap in login data means I will have to try a more specific ARIMA right? Will I be able to use arima if there are long gaps in the data? Also, the arima function in R doesn't allow for frequencies greater than 350, and it runs out of memory quickly, so I'd have to use a monthly model (freq = 12). I have tried using fourier but the predictions didn't look right intuitively. Since I want to know what the peak usages are though, I think I might want to be more specific. Is it ok to use a weekly frequency (freq = 52) and just remove Dec 31?

Is daily frequency allowable? Like can I use exponential smoothing with daily frequency even though Sept 7, 2012 might fall on a Sunday, whereas Sept 7, 2011 and 2010 and 2009 might all be weekdays. There is a daily, weekly, and yearly seasonality in demand and number of logins. Eg. 6pm, and Monday, and September are more loaded in general than 4am, and Saturday, and May. There is a yearly seasonality in number of registrations.

I've been having some issues with the login predictions The problem is that variability increases too much before 6 months have even passed. At the 80% confidence interval. The projection line extends into 2012 and the orange area is the 80% confidence interval. Logging and using additive exponential smoothing gave me much more variability than multiplicative exponential smoothing.

It's not useful to the company to say that "well you might have 8 jillion logins sometime in the next 6 months and you might have 20% more than you had last year." How do I reduce the variance in the projection?


Finally, I was thinking that after I got accurate projections, I'd put logins and registrations in a neural network, and I'd put something like average wait time on a few machines as the ouput variable, and I'd forecast peak projected processing power demand in 6 months. There are other variables to consider, like software releases that change cpu demand per user, but I'm hoping the neural network will learn when these happen, or that they are easy to detect and account for. I don't have any good data on average wait time yet, but assuming I find some, is this a good plan?


Exponential smoothing is just a special case of an ARIMA model. If there is a benefit to fitting a general ARIMA model it is because of its generality and not that it handles gaps in the data any better than exponetial smoothing. I don't see any reason for throwing out February 29th. Individual dates would not have any appriciable effect on seasonality if there is some periodic component to the series. The time unit for time series analysis can be whatever time unit you measure the data in (it could be days weeks or years). You can cumulate data to create longer time intervals for the time series model. The fact that a date in one year falls on a different day of the week than in another year has nothing to do with its utility. If there are weekly effects this can show up in a 7 day periodic component. Gaps in the data does hurt your ability to fit the model. But if a single ARIMA model would have fit well to the complete series you probably can identify it piecing together the available portions of the series keeping count through the time index of the number of days missing at each gap. I don't understand why you can't have days as the time units. Is there a problem with having a long series because it seems to me that the time unit only affects the number of time points im the series?

  • $\begingroup$ The reason I threw out February 29th is because it occurs only on leap years, and some years would have 366 days and others would have 365 days. By specifying the frequency of 365 days, I was telling the model that every 365 data points would be another year. And the reason I thought that days wouldn't be a good indication is because there's more variability between two dates in their respective year than there is between two months. $\endgroup$ – obesechicken13 Jun 29 '12 at 17:00
  • $\begingroup$ I do not see why it is necessary to describe a year as exactly 365 days. Throwing out February 29 really does not make sense. It unnecessarily puts a gap in a particular week. A year is really 365.25 days and that is why we have a leap day every four years. $\endgroup$ – Michael R. Chernick Jun 29 '12 at 17:06
  • $\begingroup$ R's function for holt winters is designed for fixed integer frequencies. It will look at timestamps and put data into the correct months or quarters for a year, but it can't deal with daily models the same way. I could go in and rewrite the code, but I doubt I have the expertise to. Since I am sampling data by day and not by week, I do not see how I am putting a gap into a particular week. Even if I were making a model by week, it's only one week. $\endgroup$ – obesechicken13 Jun 29 '12 at 17:12
  • $\begingroup$ I was referring to daily data where you would lose a Wednesday if February 29th fell on a Wednesday. Whether throwing out Wednesday creates an additional artificial gap of any consequence is not the point. You are needlessly throwing out data. $\endgroup$ – Michael R. Chernick Jun 29 '12 at 17:51
  • 1
    $\begingroup$ There are exponential smoothing models that don't fall within the ARIMA framework, e.g.: users.ox.ac.uk/~mast0315/DampedPegels.pdf $\endgroup$ – Zach Jul 29 '12 at 19:34

First of all, you should check out the auto.arima and ets functions in the forecast package.

Secondly, you should consider which frequency is most appropriate for the data. Do you really expect that the logins on 11/1/2011 will be directly related to the logins on 11/1/2001, 11/1/2002...11/1/2010? Make some seasonplots of your data at different frequencies, and see if you can identify what seems to be the most "natural." I would suggest trying frequency=7, as it makes intuitive sense to me that the number of logins on a Sunday will be directly related to the number of logins last Sunday, and the Sunday before that.

Thirdly, if you use an arima model, you can use the xreg term to pass dummy variables to represent other seasonal periods, such as day of the month, day of the year, month of the year, and holidays. The holidayNYSE function in timeDate is useful for finding holidays.

Fourthly, if you start fitting any neural networks, make sure you cross-validate them! Cross-validating time series is difficult, but here's some R code to help you out.

Finally, before you go too crazy with the analysis, consider your overall goal. For example, if your single goal is to accurately forecast peak CPU demand 6 months in advance, perhaps you should aggregate all your data to the monthly level before making your forecasts. You could fit an arima model to CPU demand, and use logins and registrations as your external regressors.

  • $\begingroup$ I'm not sure I understand. Should I aggregate CPU demand data as well? The patterns of seasonality are easier to see when aggregated, but then I lose some fidelity. I can't have a single day of demand that's really high even if the month is fine. $\endgroup$ – obesechicken13 Jul 31 '12 at 13:03
  • $\begingroup$ Also I do sort of expect November 1 2011 to correlate with November 1 2012 if only because students like to start doing their assignments before exams in November. It may not be a good correlation but I think around Nov 1, say Nov 2 has some correlation. I see where you're coming from though. I have aggregated data by month before. It's nice. $\endgroup$ – obesechicken13 Jul 31 '12 at 13:11
  • $\begingroup$ @obesechicken13 If you are trying to forecast max cpu demand 6 months in advance, you could look at the monthl max cpu demand. $\endgroup$ – Zach Jul 31 '12 at 15:58
  • $\begingroup$ @obesechicken13 Also, you could add dummy variables for known academic dates, like exam starts, etc. $\endgroup$ – Zach Jul 31 '12 at 15:58

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.