1
$\begingroup$

I have a daily time series data of inbound call centre of last 10 months and i need to forecast for next two months. My all future forecasts are repeating after a week i.e. values of 2nd,3rd and 4th week are same as first week which is not the case as in the series historically.

data_ts <- ts(data$Chats_Number,start = decimal_date(as.Date("2017-01-27")),frequency = 7) 

Fourier terms are used to capture seasonality and k selected based on min AICc

xreg <- fourier(data_ts,K=3)
fit <- auto.arima(data_ts,xreg = xreg,seasonal = FALSE,lambda = 0)

summary(fit)
Series: data_ts 
Regression with ARIMA(1,1,2) errors 
Box Cox transformation: lambda= 0 

Coefficients:
      ar1      ma1      ma2     S1-7     C1-7     S2-7    C2-7    S3-7     C3-7
  -0.5743  -0.0841  -0.4290  -0.4538  -0.0843  -0.0276  0.2803  0.1604  -0.0427
s.e.   0.4588   0.4491   0.2998   0.0164   0.0164   0.0154  0.0154  0.0144   0.0144

sigma^2 estimated as 0.04724:  log likelihood=35.71
AIC=-51.42   AICc=-50.64   BIC=-14.61

Training set error measures:
               ME     RMSE     MAE        MPE     MAPE      MASE       ACF1
Training set 10.49613 66.75743 39.8977 0.08827764 12.58295 0.6308544 0.08468087 

forecasts <- forecast(fit,xreg = fourier(data_ts,K = 3,h=60)) 
forecast

Point Forecast    Lo 80     Hi 80     Lo 95     Hi 95
 2059.786       733.0478 521.5679 1030.2763 435.57098 1233.6888
 2059.928       675.4585 475.5280  959.4473 394.90127 1155.3372
 2060.071       392.7527 273.6144  563.7669 225.96364  682.6528
 2060.214       256.1152 176.6352  371.3587 145.09729  452.0760
 2060.357       737.4148 503.5734 1079.8437 411.50345 1321.4484
 2060.500       765.9576 518.0710 1132.4530 421.20582 1392.8844
 2060.643       778.4533 521.6047 1161.7794 421.97730 1436.0714
 2060.786       733.3445 486.8999 1104.5270 391.99627 1371.9368
 2060.928       675.3015 444.3614 1026.2639 356.05553 1280.7893
 2061.071       392.8052 256.2159  602.2105 204.34812  755.0640
 2061.214       256.0956 165.6139  396.0110 131.48760  498.7918
 2061.357       737.4473 472.8948 1149.9989 373.77846 1454.9487
 2061.500       765.9382 487.1177 1204.3523 383.33761 1530.4038
 2061.643       778.4646 491.0779 1234.0348 384.79543 1574.8814
 2061.786       733.3384 458.9319 1171.8190 358.08996 1501.8157
  -              -             -      -      -          - 

Is this because i had less data or is there any way around?

Edit: Model summary added,and plot and data enter image description here

library(forecast)
library(lubridate)
library(tseries)
library(fpp2)

a <- paste0(c("30 97 233 211 199 206 203 118 63 241 207 195 177 179 80 84 228 224 220 217 144 92 81 165 191 307 289 271 181 144 367 371 352 386 362 219 126 431 403 382 343 362 220 154 404 321 383 331 325 199 125 346 387 338 349 336 178 144 347 377 396 332 285 167 144 403 353 333 302 306 201 109 422 355 339 372 357 163 106 382 310 357 299 309 175 134 354 374 390 366 347 169 107 386 276 357 319 352 179 121 391 364 414 368 317 395 127 573 514 646 639 499 329 185 546 570 592 561 492 221 143 222 549 610 577 468 243 161 566 537 565 563 501 285 135 549 469 543 465 457 247 147 508 511 505 498 428 223 178 469 565 521 459 423 231 138 462 416 169 395 419 243 166 494 522 520 491 473 292 181 460 471 596 545 486 267 143 457 468 458 433 454 255 160 425 434 457 416 435 561 232 510 620 744 676 614 305 207 581 641 620 527 507 274 153 424 489 485 433 423 278 195 484 546 568 497 448 226 161 237 520 584 532 490 255 177 550 537 508 474 450 249 135 427 441 462 372 340 233 152 404 436 416 384 379 196 134 396 402 413 373 355 203 104 384 452 407 381 359 98 126 429 422 428 398 380 247 143 430 427 459 437 407 215 111 445 465 466 422 446 247 130 375 410 444 369 170 683 260 565 789 772 774 805"),collapse = NULL)
a <-  as.numeric(unlist(strsplit(a," ")))
data_ts <- ts(a,start = decimal_date(as.Date("2018-01-27")),frequency = 7)
autoplot(data_ts)
$\endgroup$
3
  • $\begingroup$ Could you please plot the time series for us? And report the selected model? $\endgroup$ Commented Nov 26, 2018 at 12:59
  • $\begingroup$ Probably just a bad model . Post your data and I will try to help. Although this series appears to be non-stationary ... differencing may not be the correct approach, You appear to have a few ARMA coefficients that are not significant. $\endgroup$
    – IrishStat
    Commented Nov 26, 2018 at 13:17
  • $\begingroup$ There are a number of similar questions (with answers) here at Cross Validated, please look around and see if some of the answers are relevant. $\endgroup$ Commented Nov 26, 2018 at 13:20

2 Answers 2

8
$\begingroup$

auto.arima() fits a regression on your Fourier terms and models residuals using ARIMA. In your case, the residuals are modeled as ARIMA(1,1,2). This is not a "flat line" forecast, and if you look closely, you will see that the fits do not repeat exactly. It just appears this way, because the intra-weekly seasonality is by far the strongest signal.

Unless you have a good reason to expect something different (e.g., calendar events, or intra-yearly seasonality), this is probably a pretty good model. You may want to look at models for .

If you are concerned that the forecast does not reproduce the variability in your historical data: don't be. Forecasting models attempt to disentangle the signal from the noise and only extrapolate the signal, because the noise is - by definition - not forecastable. Therefore, any forecast will look smoother than the original time series.

$\endgroup$
1
  • $\begingroup$ @ Stephan i shared the results of two weeks. remaining 6 weeks are all repetitive. The challenge here is even if i share these results it will generate lot of additional query. Also the forecast is bit on higher side $\endgroup$
    – joy_1379
    Commented Nov 26, 2018 at 15:18
0
$\begingroup$

I took your 294 daily values into AUTOBOX ( a forecasting package that I have helped to develop) and it delivered the following forecasts for the next 21 days ) enter image description here . The similarity of the forecasts is due to the strong day-of-the-week pattern evidented in the data.

The model that was automatically identified is non-trivial but explicable as your data has a number of "opportunities" .

Here is the Actual/Fit and Forecast graph enter image description here . The equation that was developed suggests two trends and 2 level/step shifts along with 4 daily seasonal and an AR(1) component. enter image description here and here enter image description here . In tabular form enter image description here.

Note that 6 values were found to be exceptional (one-time anomalies) with 4 of them being quite recent (291,292,293 and 294). If you know the reason behind the recent exceptional values then it might be appropriate to add a dummy indicator and specify whether or not this phenomenon represents a "new level". If so the forecasts would indeed come off the new high level.

Note that the confidence intervals in the forecasts do not include the possibility of future anomalies , which is a user option not presented here.

The statistical summary is here enter image description here

The Residual Plot is here enter image description here

In summary the forecasts generated with this model are not simply based upon previous values (ala arima) but rather primarily based upon identified repeatable patterns ( 4 daily indicators ) . The four seasonal indicators are sympathetic to the Fourier Coefficients insofar as they are deterministic in form BUT ARE MUCH CLEARER IN INTERPRETATION. A primary difference between this approach and yours is the detection of both changes in trend and changes in level.

Hope this helps.

$\endgroup$
4
  • $\begingroup$ @ IrishStat the pattern of point forecast part seems to be repeating exactly week after week which was my concern. As you said it's because of strong day of week pattern I guess if I had more data then annual pattern also would have been captured and then giving a slight deviation from repetitive view. I am trying to understand more about AUTOBOX online. Your point forecast are more relevant than mine as mine was bit on higher side. Thanks for your help $\endgroup$
    – joy_1379
    Commented Nov 28, 2018 at 15:31
  • $\begingroup$ You are quite correct that if the series is afftected by day-of-the-month, week-of-the month , month-of-the-year , pre and post holiday efftects , long-weekend effects then one needs to up-armor and develop further conditional variables into the model. $\endgroup$
    – IrishStat
    Commented Nov 28, 2018 at 15:35
  • $\begingroup$ as is (optionally) implemented in AUTOBOX .... The reason for your HIGH forecasts was the fact that your model believed that the recent pulses were to be believed rather than than to be adjusted. This is also an option in AUTOBOX . $\endgroup$
    – IrishStat
    Commented Nov 28, 2018 at 15:47
  • $\begingroup$ one other point worth mentioning .. it is always possible that the day-of-the-week variables ( 4 in this case ) change over time. AUTOBOX looks for conditions like this and if necessary create/identify/generate seasonal pulse indicators which deal with the empirical transience of day-of-the-week effects. If you wish to continue this off line please feel free to contact me. $\endgroup$
    – IrishStat
    Commented Nov 28, 2018 at 19:45

Your Answer

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

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