# How to forecast multivariate time-series 'accurately' with a large number of unknown factors using R?

I am relatively new to statistics and not formally trained but have been given a complex problem to solve and need some guidance. I realise that I am out of my depth a bit here but would appreciate whatever help I can get bearing in mind that there is no budget for this and as a result it is not possible to purchase software or hire consultants.

The Problem

The business I work for has a large number of mobile representatives that can be dispatched to a variety of different jobs. There are ~100 different job types and each job can be broken up into 4 different final outcomes. Each of these 400 outcomes requires an allocation of man hours to complete. I have a count of how many times each one of these outcomes occurred in each hourband for the past 5 years.

I have been asked to forecast how many of each outcome will occur in each hourband for the 28days from the present. The resulting forecast will be used to anticipate staffing requirements on an hour-by-hour basis. As a result the forecasts for each hourband need to been fairly accurate.

Factors

In my data there are clearly some yearly, weekly, and daily seasonal effects. In general each outcome is more likely to occur at certain times of the day on certain days of the week and with some yearly trends.

Each different outcome is likely to be related to the frequency of a number of different outcomes. i.e. if x happens then y and/or z are likely but a and/or b are not.

There are a large number of environmental factors that contribute to the frequency of each outcome. These can include, but are not limited to weather, sociopolitical, financial trends, one off events.

What I have tried

So far I have tried using simple auto.arima, holtwinters and ets forecasts. holtwinters ended up producing a flat line (i.e. 5 and hour for the next 672 hours). ets doesnt work because the seasons are longer than 24 intervals. auto.arima produced the best results but they were still a long way off being accurate.

It was then suggested that I try tbats() and provide it with multiple seasonal lengths. I achieved best results by giving it seasonal lengths of 8760 (1yr) and 168 (1wk). Frustratingly, these results are within 1% when viewed as a sum of all hourbands in a 1 month block but are anything up to 300% (avg 20%) off when considering each individual hourband.

Both of these approaches have been applied over an individual outcome rather than considering all possible outcomes (and their correlation to each other).

My thoughts so far

At this stage I feel like my two options are to either to find a way to use something similar to tbats() that will look at the relationships between the multiple different outcomes as well as the seasonality and forecast based on that information.

or

Abandon that approach for a Neural Network model. My understanding (limited) is that using the Neural Network approach I may be able to 'factor' for the multitude of unknown environmental factors without having to actually identify them. I know this is lazy but my feeling for the data is that there are going to be a fair few unknown factors to identify and forecasting them may end up being a job in itself (i.e. weather conditions)

The Question (finally)

What I am looking for is some guidance.

Considering the information above and the fact that I am pretty much limited to R, what is the best approach??

and

What are the basic steps I need to follow?

While I cant post my data online (due to my employers restrictions) I can send it an individual or two if someone was interested in giving us a hand to find a solution.

• As a "rule" this forum is not for giving out free statistical consultations to businesses who are unable/unwilling to pay professionals. Moreover, your question is extremely difficult to answer without seeing the diagnostic plots, what you used to determine whether a forecast is "good" or "bad". May 21, 2014 at 7:53
• I concur with @rocinante comments. It appears to me that there are two aspects to your problem/opportunity. The first (which I am quite capable of handling/consulting on) is methodological in nature i.e. what specific procedures are needed and the second question is what software is appropriate/cost effective. May 21, 2014 at 13:08
• Ok that's fair enough. What I have asked for is basically free professional advice and I agree that in principal that is abusing the forum. What I probably should have included is that this project is more about me personally trying to advance my knowledge than it is about what my employer wants, hence the 'no budget' part. I am allowed to use the data but its not a 'sanctioned' project. From my perspective, if i can get this to work then I gain a bunch of useful skills/knowledge and as a by product my employer gets a useful tool. I'm not sure where that leaves this question ethnically.
– Tim
May 21, 2014 at 23:04
• @IrishStat I am still working on this problem at the moment but am just not making any headway. What further information would you need to help point me in the right direction methodology wise? and software wise? Given the time-frames this is really now just a personal project because I intuitively know it should be possible and am annoyed that I haven't been able to work it out.
– Tim
Jun 9, 2014 at 3:27
• before taking the time series route,I would simply build a naive model and see how it predicts. I would also use structured judgement to adjust for special events etc., Jul 5, 2014 at 18:44

In my experience you only get so far with traditional time series models. Given the complexity you describe I'd try a non-linear machine learning algorithm like random forests. Have a play with the R package 'rf'. There's a nice blog post with example code from a Kaggle competition here:

http://blog.kaggle.com/2012/05/01/chucking-everything-into-a-random-forest-ben-hamner-on-winning-the-air-quality-prediction-hackathon/

If machine learning is unfamiliar to you, then this is the reference:

http://statweb.stanford.edu/~tibs/ElemStatLearn/