We're developing real-time alerts for fine-grained (every 5 minutes) time series bookings data, and I'm looking for the best approach to doing this. Idea is that if over the past 10–15 minutes (say) there's a big drop in bookings volume relative to some expectation, then I want to fire an alert. We've been using historical data to set the expectation.

I'm familiar with time series analysis and exponential smoothing. Holt–Winters came up as a possibility here, but even triple exponential smoothing appears to handle only one seasonality, and bookings data in my industry (travel) definitely has at least three driving seasonalities: daily, weekly and annual.

What we've been doing. One approach we've been using – and it seems to work OK in most cases – is to do a difference between two sample means hypothesis test. Say that we break bookings up into five-minute blocks. Then we build a size three sample over the past 15 minutes, a size 12 sample for the corresponding 15 minute spans over the past four weeks, and then test the difference in their means.

I am a concerned that the sample sizes (especially for the current bookings sample) are too small to be trustworthy. The test accounts for sample size, and anyway the variance within a sample is generally quite small, at least at volume, so maybe this is OK. But using an $n=3$ sample feels wrong. Besides this approach neglects the annual cycle, which I'd like to be able to capture if possible.

Extra background. A couple of considerations to add. Not sure about their relevance, but just in case:

1) These are global bookings (i.e. people all over the world book), so the bookings volumes are not simple sinusoids. They are roughly the sum of multiple bookings sinusoids corresponding to different regions (NA/LATAM, EU, APAC) in addition to those associated with the different seasonalities. I know we can analyze the individual regions to tease apart the sinusoids, and we want to do that. But also we want to know when the aggregate volume has dropped.

2) There is some sense in which bookings seem to have a binomial distribution. If we fix the user volume, then we can think of a booking as a "success" in a binomial trial. This comes up for example if you have a web server farm with many servers, and you look at the distribution of bookings counts across the servers within a short time window (e.g. 30 minutes). That distribution passes a normality test (I've been using Shapiro), and I assume it's because it's a binomial distribution given the underlying mechanism. Bookings over time aren't binomially distributed because the user volumes themselves fluctuate widely. But I still wonder if somehow we can use the large number of underlying binomial "conversion opportunities" as a way to drive an appropriate test.

My question is: what approach should we be using to test for bookings drops, given the above?

Update. Based on what Stephan says below (that this is really anomaly detection, not forecasting), I have another idea. What if I were to build a comparison sample based on historical 5-minute bookings counts (e.g. seven 5-minute blocks from the previous week, flanking and including the block corresponding to the current one, another seven from the week before that, and so on, maybe four weeks back, giving me an $n=28$ sample), and then use an interquartile range-based outlier test? Simple, and the detection bands are given by the boxplot whiskers. Is this at all plausible?


There are at least two more use cases for the kind of complex seasonality you have: electricity consumption and call center demand. Both have strong intra-day patterns and day of week seasonality, and at least electricity also has a big yearly effect (call centers probably less so). Both are typically analysed in 5- or 15-minute intervals. And both are active areas of research, so googling for "electicity forecasting" or "power forecasting" or "call center forecasting" may already be helpful. I particularly recommend this paper, which treats quite a few different methods.

Unfortunately, what you are interested in is not the point forecast per se, but anomaly or signal detection or monitoring. I don't recall anything like this in the forecasting literature, but there may be something in the signal processing literature. I suggest you use the keywords above and google for "signal detection in electricity time series" and similar.

If you don't find anything, I would recommend a simple and dirty approach: look at the Taylor article I linked above, fit one of the models and try to understand residual variance. It is homoskedastic, or does it vary over time, or with the underlying level? Calculate the fit and create some "reasonable" detection band around it, based on your understanding of the residual variance. Raise an alert if recent data are outside this band. You will need to experiment a little, anyway. Good luck!

  • $\begingroup$ Thanks Stephan for your thoughts and for the paper. If I understand the concern around residual variance correctly (I'm at best a dabbler in statistics), then yeah, it varies greatly with bookings volume. If we look at weekday bookings during the US afternoon, then variance is low. But weekend bookings during the US night would have higher variance. Especially if we narrow it down to specific products (e.g. vacation packages). $\endgroup$ – Willie Wheeler Apr 3 '14 at 7:23
  • $\begingroup$ We are doing the "detection band" right now, based on the difference between two sample means test. Like I said it mostly works (as long as today isn't a holiday, as long as there wasn't an outage in the historical sample, etc.) but looking for other approaches to consider. I'll take a look at the paper so thanks again. $\endgroup$ – Willie Wheeler Apr 3 '14 at 7:26
  • 1
    $\begingroup$ This sounds Poisson-y to me, which would make sense. Try normalizing residuals by fits: $(y-\hat{y})/\hat{y}$ (dealing with small $\hat{y}$ separately) and examining the variance of these transformed residuals. This essentially models residual variance as a linear multiple of the underlying mean. $\endgroup$ – Stephan Kolassa Apr 3 '14 at 7:27
  • 1
    $\begingroup$ I kind of hope that the normalized residual variance is homoskedastic and does not exhibit any patterns any more. If so, let $s^2$ be the mean of the squared normalized residuals. You can now forecast bookings for the next couple of time buckets and use $k\times\hat{y}\times s$ as the width of the detection band, where $\hat{y}\times s$ is a "Poisson-y" level-dependent standard deviation, and $k$ is a parameter you could tune to get the desired amount of alerts. $\endgroup$ – Stephan Kolassa Apr 3 '14 at 7:39
  • 1
    $\begingroup$ Your update seems quite feasible to me. It would again not account for yearly seasonality, or holiday effects (people being at home over Thanksgiving and spending their time booking travel). But depending on your needs, it may definitely be enough. I'd recommend prototyping this quickly in R and seeing if this meets your requirements. $\endgroup$ – Stephan Kolassa Apr 3 '14 at 15:44

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.