1
$\begingroup$

I looked around to see if there was a similar question, but couldn´t find one. I apologize if there is one and I missed it.

I have the amount of ticket sales per day for 10 different events. The amount of days is different for each event, as well as the number of ticket sold per event. Almost all events show a spike in ticket sales at the start of the selling period.

I want to be able to forecast the (multiple) ticket sales. I do not want to forecast each event individually, but one model that fits (more or less) all. I tried combining the data and use auto.arima (in R) on the combined data, but I have the impression the spikes influence too much the result.

What would be the best way to proceed? How can I take into account all events?

Example data:

tt <- list(
    c(6,3,532,162,54,69,84,43,27,42,54,44,27,21,45,34,26,32,15,27,17,14,5,19,6,
        21,12,10,27,30,22,19,13,22,41,14,211,22,4,27,28,13,15,19,5,13,8,23,33,25,16,41,
        18,36,24,26,25,27,42,37,24,32,32,32,34,49,33,72,28,73),
    c(12,4,4,14,8,15,2472,2144,1031,462,214,340,286,263,244,196,178,73,152,216,487,350,311),
    c(16,2,11845,2374,1492,2074,1654,1303,1090,978,912,542,968,832,1097,724,654,
        645,403,482,12,5740,988,50,8,843,137,6,754,585,111,194,247,162,248,111,122,201,
        208,166,49,2,78,168,446,106,78,1))
$\endgroup$
  • 1
    $\begingroup$ Have I understood correctly, that you want a model which can forecast sales for any given individual event? Further, that you'd like to forecast events not part of the fitting of your model? $\endgroup$ – Emir Jan 27 '15 at 9:46
  • $\begingroup$ Yes,I would like to predict on any individual event by having one fitting formula for the multiple events. $\endgroup$ – Andres Jan 27 '15 at 10:56
  • 1
    $\begingroup$ I imagine the data might have a secondary spike just before the event (last minute decisions) as well as a dependence on day of the week / weekend. This will affect any joint model unless all sales periods are identical (same number of days on sale) and events take place on the same day of the week. Does that bother you? Sample data would be helpful. $\endgroup$ – Floris Jan 27 '15 at 11:53
  • $\begingroup$ Thanks for your answers. Here is a sample data of three events: t1<-c(6,3,532,162,54,69,84,43,27,42,54,44,27,21,45,34,26,32,15,27,17,14,5,19,6,21,12,10,27,30,22,19,13,22,41,14,211,22,4,27,28,13,15,19,5,13,8,23,33,25,16,41,18,36,24,26,25,27,42,37,24,32,32,32,34,49,33,72,28,73] t2<-c(12,4,4,14,8,15,2472,2144,1031,462,214,340,286,263,244,,196,178,73,152,216,487,350,311) t3 $\endgroup$ – Andres Jan 27 '15 at 12:08
  • $\begingroup$ t3<-c(16,2,11845,2374,1492,2074,1654,1303,1090,978,912,542,968,832,1097,724,654,645,403,482,12,5740,988,50,8,843,137,6,754,585,111,194,247,162,248,111,122,201,208,166,49,2,78,168,446,106,78,1) For now, I consider days as a vector count with size of data length, i.e., days = 1:length(t1) (or t2 or t3). I am not taking into account weekends or weekdays (although this could be implemented in the future). Thank again! $\endgroup$ – Andres Jan 27 '15 at 12:16
1
$\begingroup$

Let's plot your data:

opar <- par(mfrow=c(1,length(tt)))
    for ( ii in seq_len(length(tt)) ) plot(tt[[ii]],type="o",xlab="",ylab="",main=ii)
par(opar)

time series

We can already see a couple of things:

  1. Your series have very unequal lengths.
  2. You typically have a peak near the beginning - but the peak can also occur one third into the series (see series 2), with very low sales before that.
  3. You may have a secondary peak around mid-way through your series (series 1 & 3), but not necessarily (series 2).
  4. Your series differ very much in scale (which is not evident from the plots), with totals between 2786 (series 1) and 41908 (series 3).

This will be very, very hard to forecast if you have high hopes for accuracy.

"Typical" time series forecasting algorithms like ARIMA or Exponential Smoothing will not work here. They forecast univariate series out into the future.

I would start with a simple approach. For instance, we could first rescale your series to a target length. I'll use the median length of your series, but if you know that your actual data will have a length of 50, you can use that.

dest.length <- median(sapply(tt,length))

I'll rescale linearly, using an appropriate matrix. Check this for small values of nsource and ndest to understand what is happening here.

make.scale.matrix <- function(nsource, ndest) {
    zero <- matrix(0,nrow=ndest,ncol=nsource)
    f0 <- matrix(0:(ndest-1),nrow=ndest,ncol=nsource,byrow=FALSE)/ndest
    t0 <- matrix(1:ndest,nrow=ndest,ncol=nsource,byrow=FALSE)/ndest
    f1 <- matrix(0:(nsource-1),nrow=ndest,ncol=nsource,byrow=TRUE)/nsource
    t1 <- matrix(1:nsource,nrow=ndest,ncol=nsource,byrow=TRUE)/nsource
    pmax(zero,pmin(t1,t0)-pmax(f1,f0))*nsource
}

We rescale each entry of a list using lapply():

tt.rescaled <- lapply(tt,function(xx)(make.scale.matrix(length(xx),dest.length)%*%xx)[,1])

Let's plot the rescaled series:

opar <- par(mfrow=c(1,length(tt)))
    for ( ii in seq_len(length(tt)) ) plot(tt.rescaled[[ii]],type="o",xlab="",ylab="",main=ii)
par(opar)

ts rescaled

As you can see, these still look similar to your original series, but now they are comparable, because they have the same length. In addition, the rescaling keeps the original totals over time:

> sapply(tt,sum)
[1]  2786  9476 41908
> sapply(tt.rescaled,sum)
[1]  2786  9476 41908

So, now we can do some extremely simple modeling and forecasting. For instance, we can simply take pointwise averages:

forecast <- colMeans(do.call(rbind,tt.rescaled))
plot(forecast,type="o",xlab="",ylab="")

forecast

As you see, this average is dominated by series 3, which has the highest sales. An alternative would be to forecast total sales (e.g., as the average or the median of total sales) and the "lifecycle" (as the average of each rescaled series' lifecycle) separately:

lifecycle <- colMeans(do.call(rbind,lapply(tt.rescaled,function(xx)xx/sum(xx))))
forecast.alt <- lifecycle*mean(sapply(tt,sum))
plot(forecast.alt,type="o",xlab="",ylab="")

alternative forecast

We now see three peaks: the first and the third peak come from series 1 & 3, the second peak from series 2.

Is the first or the second forecast better? It's hard to tell. Of course, you could also start going over this with a kernel smoother or some such.

I would recommend using some very simple approach like this one. Don't overthink the statistical part. Instead, spend your time on getting more information. Can you find out:

  • why a series has a certain length
  • why a series has its initial peak right at the beginning or later
  • why a series has a second peak or not
  • why the total amount for a series is what it is

All data along these lines will help you understand your time series better, and you will be able to use this in forecasting. Until then, you should also work on the entire process. Is it a problem if you mistime a peak? Or not? Or is getting the total wrong worse?

$\endgroup$
  • $\begingroup$ Dear Stephan, thank you very much for all the time you took on this! I really appreciate. I will follow your advice, work with the simple approach you propose, and see how it behaves with the other data I have (I have some other events). Thanks again! $\endgroup$ – Andres Jan 28 '15 at 14:31
  • $\begingroup$ You're welcome. Feel free to upvote and/or accept my answer if it helped you. $\endgroup$ – Stephan Kolassa Jan 28 '15 at 14:56

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.