Search code examples
rforecastingarimaholtwinters

Exponential smoothing forecasting for multiple time series


I would like to forecast 100x time series in r using exponential smoothing (HW or ARIMA) because my data is very seasonal. My data is currently setup like:

Month / Employee1 / Employee2 / Employee3 / ...
2015-01-31 / 1,200,000 / 1,900,000 / 800,000 / ...
2015-02-28 / 1,000,000 / 1,700,000 / 200,000 / ...
... Through 2018-06-30

I would like to forecast using exponential smoothing for each employee for 6 periods where frequency = 12. I can do this easily individually using forecast, but I would like to run all employees at once into a single table output. The confidence level can equal to 0 level=c(0,0) since I want a single output.

Any help is much appreciated!


Solution

  • I figured it out and hopefully it will help in the future. My data set is called "Multiforecast_test"

    First I made it into a ts:

    ts_test <- ts(Multiforecast_test, start= c(2015,01), frequency=12)
    

    Then I used lapply to run the auto.arima function:

    arimaforecast <- lapply(ts_test, function(x) forecast(auto.arima(x), h=6,)$mean)
    

    The output for my test data results in:

    arimaforecast

    $Volume        Jul        Aug        Sep        Oct        Nov        Dec
    2018 1005256299 1107626858  929720018  889901375  814714019  839815505
    
    $Employee1     Jul       Aug       Sep       Oct       Nov       Dec
    2018 683043831 800911854 686582210 665243135 613016109 626239041
    
    $Employee2     Jul       Aug       Sep       Oct       Nov       Dec
    2018 198639231 206957874 138334667 148160835 118637508 111321392
    
    $Employee3     Jul       Aug       Sep       Oct       Nov       Dec
    2018 116508747 129413942 111011512  90294567  87439508  92747072
    
    ...
    

    Hopefully this helps someone in the future.