4
$\begingroup$

My aim is to forecast the daily number of registrations in two different channels.

Weekly seasonality is quite strong. Especially the difference between the weekends and the rest of the week is big. I also observe annual effects. Moreover, I have a few special event days, which significantly differ from the others days. Here is the dataset.

First, I applied a TBATS model on these two channels.

x.msts <- msts(Channel1_reg,seasonal.periods=c(7,365.25))
# fit model
fit <- tbats(x.msts)
fit
plot(fit)
forecast_channel1 <- forecast(fit,h=30)

First channel:

TBATS(0, {2,3}, -, {<7,3>, <365.25,2>})

Call: tbats(y = x.msts)

Parameters
  Lambda: 0
  Alpha: 0.0001804516
  Gamma-1 Values: -1.517954e-05 1.004701e-05
  Gamma-2 Values: -3.059654e-06 -2.796211e-05
  AR coefficients: 0.249944 0.544593
  MA coefficients: 0.215696 -0.361379 -0.21082

Second channel:

BATS(0, {2,2}, 0.929, -)

Call: tbats(y = y.msts)

Parameters
  Lambda: 0
  Alpha: 0.1652762
  Beta: -0.008057904
  Damping Parameter: 0.928972
  AR coefficients: -0.586163 -0.676921
  MA coefficients: 0.924758 0.743675

If I forecast the second channel, I only get blank values instead of any forecasts.

Could you please help why is that so? Do you have any suggestion how to build in the specific event days into this model?

$\endgroup$
4
  • $\begingroup$ adde a dummy variable (0/1) for the special events in your dropbox file them? what country is this data from? what is the first date in the dataset? $\endgroup$
    – Tom Reilly
    Feb 26, 2016 at 13:55
  • $\begingroup$ I added the dummy variable, plus reformated the date. The first date is 1 Jan2010. I have 2 different event types. Both events are two days long, but event1 is mainly concentrated on the second (last) day. Therefore, now I put 0, 0.5 and 1 to event1 dummy. I am not sure if it is the right approach. $\endgroup$
    – ponthu
    Feb 26, 2016 at 15:26
  • $\begingroup$ what country is this for? yes, you have added some good information. You would also need to specify the events in the future too as if they are significant in the model then you would want to flag when they occur in future. The use of .5 and 1 is very good. I have only seen the US DOT use something so fancy as I saw a few year ago. If there are any lead or lag effects then you will be missing them unless you capture them in the model itself. $\endgroup$
    – Tom Reilly
    Feb 26, 2016 at 16:00
  • $\begingroup$ it is not specified for country, visitors from a couple of countries, mainly Western-Europe. Do you have any idea what's wrong with the second channel? Plus do you know how I could build these variables into the forecast model? Thanks for your help, much appreciate it! $\endgroup$
    – ponthu
    Feb 26, 2016 at 16:30

2 Answers 2

2
$\begingroup$

Facebook has recently opened it R/Python API of 'Prophet Model'.It handles multiple level of seasonality and external event days can also be passed.Have a look-

http://machinelearningstories.blogspot.in/2017/05/facebooks-phophet-model-for-forecasting.html https://facebookincubator.github.io/prophet/docs/forecasting_growth.html

$\endgroup$
1
$\begingroup$

Ponthu,

I took your data and ran it in Autobox.

Both of your events are important.

Months 1,2,3 and 12 are higher than the rest of the months.

Day 4 is typically 303 units higher than the other days of the week.

You can simulate this by creating 11 dummy variables for the monthly effects, 6 dummies for the day of the week, etc.

For Channel 2 if you take Feb 2010 to Jan 31 2012 and do some pivot tables on the 2 years of data you can get a ROUGH idea of how the data looks pivot tables for month, day of the week and day of the month to compare against the model. The model takes care of the jump in April using the Event2 variable. Day 5 and 11 seem to be important, but that is just the impact of event1 and event2. The day of the week impact changed 4 times for the 4th day of the week(monday) as you will see with the "seasonal pulses" identified. A level shift up(change in the mean ) was identified in march 2011 which went even higher in july and then was brought down a bit in november 2011.

There are a lot of outliers. If you look at the largest ones it is clear that there is some impact around christmas and new years, but you only have 2 years of data. I recommend 4. You might want to consider adding in more events.

You didn't provide future values of event 1 and 2 so I didn't provide any forecasts.

enter image description here

enter image description here

enter image description here

enter image description here

$\endgroup$
8
  • $\begingroup$ Thank you for taking your time and have a look at it! I will add as much events as I can, to improve the accuracy of the forecast. My current model in R, takes into account weekly and annual seasonality. What do you think, besides that, shall I also add variables for specific months (1-4), and weekdays (e.g. day4)? $\endgroup$
    – ponthu
    Feb 28, 2016 at 13:03
  • $\begingroup$ Secondly, the final result will be visualized to monitor and compare the actual performance with previous years. For this, I would like to add a Month to date(+forecast) view (which contains the daily forecasts) and a year to date (+forecast). For this, I was wondering about creating a forecast on a monthly basis, it may be more accurate, as the max forecasted item is 11, instead of 330 (or so) What do you think? Is it good thinking? $\endgroup$
    – ponthu
    Feb 28, 2016 at 13:04
  • $\begingroup$ Ponthu, Post your model and results. When you say that your model takes into account weekly and annual seasonality isn't that really the same thing?? You asked me "what I think"....the model I posted above is "what I think" until I can see what you have done, I can't compare the two. Have you compared the two? Are you identifying outliers? If not then the coefficients in your model will be skewed. As for how measuring accuracy, if you need to forecast at a daily data you should measuring it at a daily level. $\endgroup$
    – Tom Reilly
    Feb 29, 2016 at 14:39
  • $\begingroup$ Model results: tinyurl.com/zush5lm I do not have covariates for outliers only for two events, so probably it gives me worse results. I appreciate your model, however, I'd like to do all in R, but unfortunately I am not able transform your output into a working model, that's why I carried on working in R, following your suggestions. Let me explain the "monthly part". I was thinking about having a forecast based on daily data, and besides another one, which is based on monthly figures. As I want to see the actual month's daily figures, but for longer term I only need monthly forecasts. $\endgroup$
    – ponthu
    Mar 1, 2016 at 13:13
  • $\begingroup$ For this monthly forecast, which is a preferable approach: 1. forecast daily, and sum it up OR 2. forecast monthly That's what I meant, but did not explain clearly. $\endgroup$
    – ponthu
    Mar 1, 2016 at 13:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.