Test of forecasting models

All sites and drugs

Drug A

Site A

Seasonality
Week

Year

Raw data

Detail of data

Weekly totals

Detail of weekly totals

Residuals of STL model- raw data and weekly totals

Simple exponential smoothing
.model term estimate
ETS(quantity ~ season(method = “N”)) alpha 0.0001002
ETS(quantity ~ season(method = “N”)) l[0] 162.3565708

Ljung Box test for autocorrelation of residuals

.model lb_stat lb_pvalue
ETS(quantity ~ season(method = “N”)) 17.63355 0.0614688
ARIMA
.model term estimate std.error statistic p.value
ARIMA(quantity) ar1 0.6160404 0.1679880 3.667170 0.0002858
ARIMA(quantity) ma1 -0.6055922 0.1698637 -3.565165 0.0004173
ARIMA(quantity) ma2 0.1340922 0.0598298 2.241227 0.0256759
ARIMA(quantity) sar1 0.0981877 0.0639542 1.535282 0.1256726
ARIMA(quantity) constant 56.3162905 3.3440977 16.840504 0.0000000

Ljung Box test for autocorrelation of residuals

.model lb_stat lb_pvalue
ARIMA(quantity) 6.277749 0.7914132
Model testing
Weekly data

.model .type ME RMSE MAE MPE MAPE MASE RMSSE
ARIMA(quantity) Test -17.955 99.947 88.679 -Inf Inf 0.71325 0.63442
ETS(quantity ~ season(method = “N”)) Test -10.876 104.840 91.000 -Inf Inf 0.73192 0.66546
FASSTER(quantity ~ trend(1)) Test 45.033 113.580 91.000 -Inf Inf 0.73192 0.72096
prophet(quantity) Test 11.605 103.430 99.717 -Inf Inf 0.80203 0.65653
SNAIVE(quantity) Test -92.667 122.390 104.330 -Inf Inf 0.83916 0.77687
Daily data

.model .type ME RMSE MAE MPE MAPE MASE RMSSE
ARIMA(quantity) Test -1.0351 54.794 36.070 -Inf Inf 1.05120 0.84252
ETS(quantity ~ season(method = “A”)) Test -1.9517 56.102 35.553 -Inf Inf 1.03620 0.86265
FASSTER(quantity ~ trend(1) + fourier(7)) Test -17.4840 58.755 45.809 -Inf Inf 1.33510 0.90344
prophet(quantity ~ season(7)) Test -2.7376 56.269 36.108 -Inf Inf 1.05230 0.86521
SNAIVE(quantity ~ lag(“week”)) Test -2.3333 57.196 25.667 -Inf Inf 0.74802 0.87946
Cross validation

Cross validated accuracy for a variety of models using weekly data.

.model .type ME RMSE MAE MPE MAPE MASE RMSSE ACF1
ARIMA(quantity) Test -12.8198993 124.7132 102.8648 -Inf Inf 0.8375184 0.8005049 -0.2324398
ETS(quantity ~ season(method = “N”)) Test -4.5191525 123.5376 100.5418 -Inf Inf 0.8186048 0.7929590 -0.1909788
FASSTER(quantity ~ trend(1)) Test -65.0342019 144.0960 123.1841 -Inf Inf 1.0029574 0.9249186 -0.0393517
prophet(quantity) Test -6.6522803 140.3916 115.7322 -Inf Inf 0.9422842 0.9011408 0.0362728
SNAIVE(quantity) Test -0.1666667 166.2477 130.7917 -Inf Inf 1.0648975 1.0671053 0.0135623
Cross validation- daily

Cross validated accuracy for a variety of models using daily data.

.model .type ME RMSE MAE MPE MAPE MASE RMSSE ACF1
ARIMA(quantity) Test -12.151161 38.60934 28.46236 -Inf Inf 0.8242388 0.5937153 -0.0531722
ETS(quantity ~ season(method = “A”)) Test -15.265937 37.59509 28.07931 -Inf Inf 0.8131461 0.5781186 -0.0773882
FASSTER(quantity ~ trend(1) + fourier(7)) Test 8.258277 35.16723 20.55201 NaN Inf 0.5951637 0.5407842 -0.0782716
prophet(quantity ~ season(7)) Test -16.997757 38.24398 29.49117 -Inf Inf 0.8540320 0.5880969 -0.0823807
SNAIVE(quantity ~ lag(“week”)) Test -5.333333 56.33235 25.33333 -Inf Inf 0.7336256 0.8662509 -0.0092600

Site B

Seasonality
Week

Year

Raw data

Detail of data

Weekly totals

Detail of weekly totals

Residuals of STL model- raw data and weekly totals

Simple exponential smoothing
.model term estimate
ETS(quantity ~ season(method = “N”)) alpha 0.0001
ETS(quantity ~ season(method = “N”)) l[0] 2018.9770

Ljung Box test for autocorrelation of residuals

.model lb_stat lb_pvalue
ETS(quantity ~ season(method = “N”)) 271.4111 0
ARIMA
.model term estimate std.error statistic p.value
ARIMA(quantity) ma1 -1.5644956 0.0443110 -35.307164 0.0000000
ARIMA(quantity) ma2 0.5815256 0.0442398 13.144845 0.0000000
ARIMA(quantity) sma1 0.1117924 0.0564947 1.978812 0.0486708

Ljung Box test for autocorrelation of residuals

.model lb_stat lb_pvalue
ARIMA(quantity) 56.09459 0
Model testing
Weekly data

.model .type ME RMSE MAE MPE MAPE MASE RMSSE
ARIMA(quantity) Test -269.200 1095.30 815.82 -74.093 93.163 1.3412 1.21480
ETS(quantity ~ season(method = “N”)) Test -237.780 908.66 722.17 -61.588 78.739 1.1873 1.00780
FASSTER(quantity ~ trend(1)) Test -101.730 882.88 722.17 -50.728 73.447 1.1873 0.97923
prophet(quantity) Test -193.920 922.20 736.68 -60.428 80.705 1.2111 1.02280
SNAIVE(quantity) Test 10.833 1837.60 1650.20 -83.329 150.260 2.7130 2.03820
Daily data

.model .type ME RMSE MAE MPE MAPE MASE RMSSE
ARIMA(quantity) Test -36.0820 434.43 347.90 -Inf Inf 0.96973 0.62505
ETS(quantity ~ season(method = “A”)) Test -8.8812 408.04 282.32 NaN Inf 0.78695 0.58708
FASSTER(quantity ~ trend(1) + fourier(7)) Test 235.1800 531.75 379.76 NaN Inf 1.05850 0.76508
prophet(quantity ~ season(7)) Test -5.2061 476.09 324.79 NaN Inf 0.90532 0.68499
SNAIVE(quantity ~ lag(“week”)) Test 185.2100 479.98 262.02 -Inf Inf 0.73037 0.69059
Cross validation

Cross validated accuracy for a variety of models using weekly data.

.model .type ME RMSE MAE MPE MAPE MASE RMSSE ACF1
ARIMA(quantity) Test 141.9050 1119.897 935.5436 -81.45248 116.5322 1.562056 1.254452 -0.3900158
ETS(quantity ~ season(method = “N”)) Test 130.9735 1035.014 863.4654 -84.11084 115.2071 1.441709 1.159371 -0.3069377
FASSTER(quantity ~ trend(1)) Test 175.0720 1101.875 948.1003 -80.17792 116.6875 1.583022 1.234265 -0.2019976
prophet(quantity) Test 175.1060 1072.493 899.5316 -84.38533 118.4566 1.501928 1.201353 -0.2500828
SNAIVE(quantity) Test 190.6875 1307.670 1035.2292 -69.98942 113.6331 1.728499 1.464786 -0.3973729
Cross validation- daily

Cross validated accuracy for a variety of models using daily data.

.model .type ME RMSE MAE MPE MAPE MASE RMSSE ACF1
ARIMA(quantity) Test -6.314599 514.8799 362.1752 -Inf Inf 1.0099517 0.7391462 -0.0644588
ETS(quantity ~ season(method = “A”)) Test -32.049368 491.9708 336.1137 -Inf Inf 0.9372774 0.7062586 -0.0991452
FASSTER(quantity ~ trend(1) + fourier(7)) Test -132.485406 513.9743 391.2897 -Inf Inf 1.0911394 0.7378462 -0.0873330
prophet(quantity ~ season(7)) Test -11.318184 495.9942 323.3268 NaN Inf 0.9016202 0.7120345 -0.0854999
SNAIVE(quantity ~ lag(“week”)) Test -148.500000 611.1046 437.1667 -Inf Inf 1.2190708 0.8772835 -0.2450742

Site C

Seasonality
Week

Year

Raw data

Detail of data

Weekly totals

Detail of weekly totals

Residuals of STL model- raw data and weekly totals

Simple exponential smoothing
.model term estimate
ETS(quantity ~ season(method = “N”)) alpha 0.0001
ETS(quantity ~ season(method = “N”)) l[0] 3297.9622

Ljung Box test for autocorrelation of residuals

.model lb_stat lb_pvalue
ETS(quantity ~ season(method = “N”)) 159.7713 0
ARIMA
.model term estimate std.error statistic p.value
ARIMA(quantity) ma1 -1.5343538 0.0645112 -23.7842942 0.0000000
ARIMA(quantity) ma2 0.5067446 0.1204304 4.2077801 0.0000333
ARIMA(quantity) ma3 0.0608475 0.0669502 0.9088467 0.3640964
ARIMA(quantity) sma1 0.3453082 0.0591670 5.8361659 0.0000000

Ljung Box test for autocorrelation of residuals

.model lb_stat lb_pvalue
ARIMA(quantity) 57.90608 0
Model testing
Weekly data

.model .type ME RMSE MAE MPE MAPE MASE RMSSE
ARIMA(quantity) Test -160.180 1592.4 1351.3 -40.251 63.339 1.6235 1.4859
ETS(quantity ~ season(method = “N”)) Test 14.938 1447.0 1225.5 -29.304 53.342 1.4723 1.3502
FASSTER(quantity ~ trend(1)) Test -183.680 1458.5 1291.7 -37.091 58.562 1.5519 1.3609
prophet(quantity) Test 117.140 1440.6 1222.2 -23.818 49.767 1.4683 1.3442
SNAIVE(quantity) Test 10.667 2195.8 1868.0 -48.360 90.024 2.2443 2.0490
Daily data

.model .type ME RMSE MAE MPE MAPE MASE RMSSE
ARIMA(quantity) Test -21.0540 707.47 528.15 -Inf Inf 1.24260 1.01140
ETS(quantity ~ season(method = “A”)) Test -6.1685 653.88 438.91 -Inf Inf 1.03260 0.93479
FASSTER(quantity ~ trend(1) + fourier(7)) Test 354.1400 728.82 461.54 Inf Inf 1.08590 1.04190
prophet(quantity ~ season(7)) Test 9.5185 636.50 421.79 NaN Inf 0.99233 0.90994
SNAIVE(quantity ~ lag(“week”)) Test 303.1900 724.97 387.52 -40.53 142.2 0.91172 1.03640
Cross validation

Cross validated accuracy for a variety of models using weekly data.

.model .type ME RMSE MAE MPE MAPE MASE RMSSE ACF1
ARIMA(quantity) Test 101.68153 1070.105 878.7796 -15.151884 38.97492 1.068348 1.011604 -0.5428149
ETS(quantity ~ season(method = “N”)) Test 27.84641 1073.538 864.4255 -19.045617 40.06804 1.050897 1.014849 -0.4386608
FASSTER(quantity ~ trend(1)) Test 211.68458 1216.285 1029.0467 -13.243619 43.34534 1.251030 1.149793 -0.1285904
prophet(quantity) Test 253.01411 1127.766 965.8663 -10.249272 39.66578 1.174220 1.066113 -0.3393385
SNAIVE(quantity) Test 213.60417 1414.393 1084.1875 -9.827629 42.51235 1.318065 1.337070 -0.5216012
Cross validation- daily

Cross validated accuracy for a variety of models using daily data.

.model .type ME RMSE MAE MPE MAPE MASE RMSSE ACF1
ARIMA(quantity) Test 62.90364 669.9151 489.9540 -Inf Inf 1.1646896 0.9725089 0.0627889
ETS(quantity ~ season(method = “A”)) Test 69.48203 626.7777 406.4979 -Inf Inf 0.9663026 0.9098867 -0.0031281
FASSTER(quantity ~ trend(1) + fourier(7)) Test 164.92504 645.2205 428.8795 NaN Inf 1.0195069 0.9366600 -0.0123546
prophet(quantity ~ season(7)) Test 87.48954 629.0975 409.5139 NaN Inf 0.9734720 0.9132544 -0.0109208
SNAIVE(quantity ~ lag(“week”)) Test 86.45238 646.5062 365.5000 -Inf Inf 0.8688448 0.9385264 -0.2836529

Drug B

Drug B is excluded from this analysis because there is only 3 years of data for Drug B. It may be included at a later date.

Drug C

Site A

Seasonality
Week

Year

Raw data

Detail of data

Weekly totals

Detail of weekly totals

Residuals of STL model- raw data and weekly totals

Simple exponential smoothing
.model term estimate
ETS(quantity ~ season(method = “N”)) alpha 0.0412606
ETS(quantity ~ season(method = “N”)) l[0] 0.2623830

Ljung Box test for autocorrelation of residuals

.model lb_stat lb_pvalue
ETS(quantity ~ season(method = “N”)) 17.77709 0.0588423
ARIMA
.model term estimate std.error statistic p.value
ARIMA(quantity) ar1 -0.0701466 0.0586881 -1.195245 0.2328629
ARIMA(quantity) ma1 -0.9615223 0.0226335 -42.482203 0.0000000
ARIMA(quantity) constant 0.0026204 0.0018765 1.396437 0.1635358

Ljung Box test for autocorrelation of residuals

.model lb_stat lb_pvalue
ARIMA(quantity) 16.57448 0.084326
Model testing
Weekly data

.model .type ME RMSE MAE MPE MAPE MASE RMSSE
ARIMA(quantity) Test 0.2857800 0.46890 0.28578 19.2700 19.270 0.39684 0.40856
ETS(quantity ~ season(method = “N”)) Test 0.2930300 0.47409 0.29303 19.9170 19.917 0.40691 0.41308
FASSTER(quantity ~ trend(1)) Test -0.1147500 0.38994 0.35428 -17.4630 29.439 0.49195 0.33977
prophet(quantity) Test -0.0042405 0.41544 0.30066 -7.8345 22.656 0.41750 0.36198
SNAIVE(quantity) Test 0.3333300 0.81650 0.66667 25.0000 58.333 0.92573 0.71143
Daily data

.model .type ME RMSE MAE MPE MAPE MASE RMSSE
ARIMA(quantity) Test 0.181280 0.34152 0.18128 Inf Inf 1.3962 0.84428
ETS(quantity ~ season(method = “A”)) Test -0.042226 0.28420 0.18607 -Inf Inf 1.4331 0.70258
FASSTER(quantity ~ trend(1) + fourier(7)) Test -0.081532 0.29093 0.22693 -Inf Inf 1.7478 0.71922
prophet(quantity ~ season(7)) Test -0.053686 0.28469 0.20461 -Inf Inf 1.5759 0.70378
SNAIVE(quantity ~ lag(“week”)) Test -0.047619 0.43644 0.19048 -Inf Inf 1.4671 1.07890
Cross validation

Cross validated accuracy for a variety of models using weekly data.

.model .type ME RMSE MAE MPE MAPE MASE RMSSE ACF1
ARIMA(quantity) Test -0.0075191 1.084065 0.7801328 -Inf Inf 1.083293 0.9445728 -0.0314451
ETS(quantity ~ season(method = “N”)) Test 0.0083423 1.077461 0.7662528 -Inf Inf 1.064019 0.9388187 -0.0501597
FASSTER(quantity ~ trend(1)) Test -0.0477061 1.151219 0.8402641 -Inf Inf 1.166792 1.0030854 0.0617464
prophet(quantity) Test -0.1196568 1.091095 0.8348666 -Inf Inf 1.159297 0.9506983 -0.0348241
SNAIVE(quantity) Test -0.0833333 1.443376 1.0416667 -Inf Inf 1.446459 1.2576489 -0.0527453
Cross validation- daily

Cross validated accuracy for a variety of models using daily data.

.model .type ME RMSE MAE MPE MAPE MASE RMSSE ACF1
ARIMA(quantity) Test 0.1719968 0.4660033 0.1752919 NaN Inf 1.402975 1.180036 0.0022768
ETS(quantity ~ season(method = “A”)) Test 0.0523478 0.4336203 0.2286735 NaN Inf 1.830222 1.098034 -0.0152852
FASSTER(quantity ~ trend(1) + fourier(7)) Test 0.0782281 0.4285844 0.2167827 -Inf Inf 1.735053 1.085282 -0.0204113
prophet(quantity ~ season(7)) Test 0.0384269 0.4239879 0.2461915 -Inf Inf 1.970430 1.073643 -0.0208728
SNAIVE(quantity ~ lag(“week”)) Test 0.0238095 0.5976143 0.3095238 -Inf Inf 2.477320 1.513308 -0.0668105

Site B

Seasonality
Week

Year

Raw data

Detail of data

Weekly totals

Detail of weekly totals

Residuals of STL model- raw data and weekly totals

Simple exponential smoothing
.model term estimate
ETS(quantity ~ season(method = “N”)) alpha 0.0510261
ETS(quantity ~ season(method = “N”)) l[0] 0.6459055

Ljung Box test for autocorrelation of residuals

.model lb_stat lb_pvalue
ETS(quantity ~ season(method = “N”)) 35.51043 0.0001021
ARIMA
.model term estimate std.error statistic p.value
ARIMA(quantity) ar1 0.9018731 0.0750963 12.0095569 0.0000000
ARIMA(quantity) ma1 -1.0107219 0.0869925 -11.6185003 0.0000000
ARIMA(quantity) ma2 0.1885294 0.0618024 3.0505200 0.0024719
ARIMA(quantity) sar1 0.0611403 2.1419619 0.0285441 0.9772457
ARIMA(quantity) sar2 -0.0285571 0.1131540 -0.2523738 0.8009112
ARIMA(quantity) sma1 -0.0188779 2.1435048 -0.0088070 0.9929785
ARIMA(quantity) constant 0.0689545 0.0095256 7.2388623 0.0000000

Ljung Box test for autocorrelation of residuals

.model lb_stat lb_pvalue
ARIMA(quantity) 24.68882 0.0059676
Model testing
Weekly data

.model .type ME RMSE MAE MPE MAPE MASE RMSSE
ARIMA(quantity) Test 0.049325 0.51020 0.49213 -Inf Inf 0.49959 0.35046
ETS(quantity ~ season(method = “N”)) Test -0.018531 0.47177 0.43827 -Inf Inf 0.44491 0.32406
FASSTER(quantity ~ trend(1)) Test 0.507720 0.69282 0.61368 -Inf Inf 0.62298 0.47590
prophet(quantity) Test 0.293780 0.57359 0.55953 -Inf Inf 0.56801 0.39400
SNAIVE(quantity) Test 0.333330 0.81650 0.66667 -Inf Inf 0.67677 0.56085
Daily data

.model .type ME RMSE MAE MPE MAPE MASE RMSSE
ARIMA(quantity) Test 0.0141270 0.32413 0.19897 -Inf Inf 1.04670 0.60463
ETS(quantity ~ season(method = “A”)) Test 0.0241040 0.31001 0.18325 NaN Inf 0.96402 0.57830
FASSTER(quantity ~ trend(1) + fourier(7)) Test -0.0630860 0.31443 0.24194 -Inf Inf 1.27270 0.58655
prophet(quantity ~ season(7)) Test 0.0074517 0.30795 0.18820 NaN Inf 0.99003 0.57445
SNAIVE(quantity ~ lag(“week”)) Test -0.0238100 0.51177 0.26190 -Inf Inf 1.37780 0.95466
Cross validation

Cross validated accuracy for a variety of models using weekly data.

.model .type ME RMSE MAE MPE MAPE MASE RMSSE ACF1
ARIMA(quantity) Test -0.0924687 1.029245 0.8001085 -Inf Inf 0.8122313 0.7069878 0.0072847
ETS(quantity ~ season(method = “N”)) Test -0.1648498 1.146186 0.9063780 -Inf Inf 0.9201110 0.7873147 0.1682406
FASSTER(quantity ~ trend(1)) Test -0.0580629 1.186955 0.8890300 -Inf Inf 0.9025001 0.8153190 0.2119620
prophet(quantity) Test 0.0968921 1.085579 0.7857842 -Inf Inf 0.7976900 0.7456840 0.0582826
SNAIVE(quantity) Test 0.0000000 1.457738 1.0000000 -Inf Inf 1.0151515 1.0013196 0.2843137
Cross validation- daily

Cross validated accuracy for a variety of models using daily data.

.model .type ME RMSE MAE MPE MAPE MASE RMSSE ACF1
ARIMA(quantity) Test -0.0582267 0.2207598 0.1433771 -Inf Inf 0.7468548 0.4089675 -0.0512831
ETS(quantity ~ season(method = “A”)) Test -0.0648977 0.2180195 0.1415660 NaN Inf 0.7374211 0.4038910 -0.0306467
FASSTER(quantity ~ trend(1) + fourier(7)) Test 0.0639730 0.2168716 0.1039410 NaN Inf 0.5414313 0.4017645 -0.0294029
prophet(quantity ~ season(7)) Test -0.0719413 0.2192882 0.1471370 NaN Inf 0.7664402 0.4062415 -0.0155125
SNAIVE(quantity ~ lag(“week”)) Test 0.0476190 0.2182179 0.0476190 100 100 0.2480489 0.4042586 -0.0511905

Site C

Seasonality
Week

Year

Raw data

Detail of data

Weekly totals

Detail of weekly totals

Residuals of STL model- raw data and weekly totals

Simple exponential smoothing
.model term estimate
ETS(quantity ~ season(method = “N”)) alpha 0.0550134
ETS(quantity ~ season(method = “N”)) l[0] 4.2467197

Ljung Box test for autocorrelation of residuals

.model lb_stat lb_pvalue
ETS(quantity ~ season(method = “N”)) 87.48554 0
ARIMA
.model term estimate std.error statistic p.value
ARIMA(quantity) ar1 -0.9658588 0.0355692 -27.1543853 0.0000000
ARIMA(quantity) ma1 0.0059256 0.0441196 0.1343079 0.8932412
ARIMA(quantity) ma2 -0.8966608 0.0426436 -21.0268689 0.0000000
ARIMA(quantity) sar1 0.0653839 0.0596098 1.0968645 0.2735028
ARIMA(quantity) sar2 0.1455756 0.0702639 2.0718414 0.0390591
ARIMA(quantity) constant -0.0100556 0.0123544 -0.8139306 0.4162734

Ljung Box test for autocorrelation of residuals

.model lb_stat lb_pvalue
ARIMA(quantity) 83.59398 0
Model testing
Weekly data

.model .type ME RMSE MAE MPE MAPE MASE RMSSE
ARIMA(quantity) Test 0.64151 2.4227 1.7647 -Inf Inf 0.79338 0.83296
ETS(quantity ~ season(method = “N”)) Test 0.48847 2.4071 1.7184 -Inf Inf 0.77256 0.82760
FASSTER(quantity ~ trend(1)) Test 1.62290 2.8617 2.0965 -Inf Inf 0.94257 0.98390
prophet(quantity) Test 0.59426 2.4756 2.0136 -Inf Inf 0.90529 0.85116
SNAIVE(quantity) Test 0.16667 3.1885 2.8333 -Inf Inf 1.27380 1.09630
Daily data
## Warning in sqrt(diag(best$var.coef)): NaNs produced

.model .type ME RMSE MAE MPE MAPE MASE RMSSE
ARIMA(quantity) Test 0.105980 0.74299 0.42298 -Inf Inf 0.67971 0.66096
ETS(quantity ~ season(method = “A”)) Test 0.034746 0.71316 0.40522 NaN Inf 0.65117 0.63443
FASSTER(quantity ~ trend(1) + fourier(7)) Test -0.269390 0.78786 0.55025 -Inf Inf 0.88424 0.70088
prophet(quantity ~ season(7)) Test 0.060453 0.74203 0.48122 NaN Inf 0.77331 0.66011
SNAIVE(quantity ~ lag(“week”)) Test 0.023810 0.74001 0.40476 -Inf Inf 0.65044 0.65832
Cross validation

Cross validated accuracy for a variety of models using weekly data.

.model .type ME RMSE MAE MPE MAPE MASE RMSSE ACF1
ARIMA(quantity) Test -0.0615108 1.650034 1.305755 -Inf Inf 0.5851879 0.5649659 -0.1543326
ETS(quantity ~ season(method = “N”)) Test 0.0265369 1.538735 1.189461 -Inf Inf 0.5330693 0.5268574 -0.2000109
FASSTER(quantity ~ trend(1)) Test 0.0922926 1.721218 1.435999 -Inf Inf 0.6435579 0.5893391 -0.0389326
prophet(quantity) Test 0.7673312 1.796833 1.371062 -Inf Inf 0.6144559 0.6152292 -0.1200320
SNAIVE(quantity) Test 0.2708333 2.155419 1.645833 -Inf Inf 0.7375975 0.7380080 -0.1637894
Cross validation- daily

Cross validated accuracy for a variety of models using daily data.

## Warning in sqrt(diag(best$var.coef)): NaNs produced
.model .type ME RMSE MAE MPE MAPE MASE RMSSE ACF1
ARIMA(quantity) Test -0.1017775 0.4850811 0.4269597 -Inf Inf 0.6775128 0.4270123 0.0097210
ETS(quantity ~ season(method = “A”)) Test -0.0863789 0.4413631 0.3468492 -Inf Inf 0.5503909 0.3885278 -0.0543017
FASSTER(quantity ~ trend(1) + fourier(7)) Test -0.3537661 0.6193490 0.5071441 -Inf Inf 0.8047519 0.5452072 -0.0021417
prophet(quantity ~ season(7)) Test -0.0385609 0.5065576 0.4306061 NaN Inf 0.6832989 0.4459179 -0.0088296
SNAIVE(quantity ~ lag(“week”)) Test -0.1904762 0.5773503 0.3333333 -Inf Inf 0.5289436 0.5082361 0.1802981

Drug D

Site A

Seasonality
Week

Year

Raw data

Detail of data

Weekly totals

Detail of weekly totals

Residuals of STL model- raw data and weekly totals

Simple exponential smoothing
.model term estimate
ETS(quantity ~ season(method = “N”)) alpha 0.1177532
ETS(quantity ~ season(method = “N”)) l[0] 7.9912120

Ljung Box test for autocorrelation of residuals

.model lb_stat lb_pvalue
ETS(quantity ~ season(method = “N”)) 35.48464 0.0001032
ARIMA
.model term estimate std.error statistic p.value
ARIMA(quantity) ma1 -0.8780575 0.0323965 -27.1034327 0.0000000
ARIMA(quantity) sar1 0.0354841 0.0786125 0.4513799 0.6520441

Ljung Box test for autocorrelation of residuals

.model lb_stat lb_pvalue
ARIMA(quantity) 36.34574 7.34e-05
Model testing
Weekly data

.model .type ME RMSE MAE MPE MAPE MASE RMSSE
ARIMA(quantity) Test 3.9053 11.1420 5.1743 -Inf Inf 0.49484 0.55097
ETS(quantity ~ season(method = “N”)) Test 3.7817 11.0990 5.2566 -Inf Inf 0.50272 0.54886
FASSTER(quantity ~ trend(1)) Test 4.6667 11.4310 4.6667 -Inf Inf 0.44630 0.56527
prophet(quantity) Test -4.5211 9.9837 9.1045 -Inf Inf 0.87071 0.49370
SNAIVE(quantity) Test 4.6667 11.4310 4.6667 100 100 0.44630 0.56527
Daily data

.model .type ME RMSE MAE MPE MAPE MASE RMSSE
ARIMA(quantity) Test 0.63313 4.3154 0.69861 -Inf Inf 0.42239 0.58896
ETS(quantity ~ season(method = “A”)) Test 0.62472 4.3894 1.23170 NaN Inf 0.74473 0.59905
FASSTER(quantity ~ trend(1) + fourier(7)) Test 0.37721 4.3587 1.29820 NaN Inf 0.78492 0.59486
prophet(quantity ~ season(7)) Test 0.39587 4.3529 1.29290 NaN Inf 0.78173 0.59407
SNAIVE(quantity ~ lag(“week”)) Test 0.66667 4.3205 0.66667 100 100 0.40308 0.58965
Cross validation

Cross validated accuracy for a variety of models using weekly data.

## Warning in sqrt(diag(best$var.coef)): NaNs produced

## Warning in sqrt(diag(best$var.coef)): NaNs produced
.model .type ME RMSE MAE MPE MAPE MASE RMSSE ACF1
ARIMA(quantity) Test -2.1290255 11.38301 8.511963 -Inf Inf 0.8058263 0.5594841 0.5992046
ETS(quantity ~ season(method = “N”)) Test -2.6259821 12.95669 9.054866 -Inf Inf 0.8572228 0.6368320 0.6357883
FASSTER(quantity ~ trend(1)) Test -2.0161909 13.80218 8.287724 -Inf Inf 0.7845976 0.6783881 0.6142209
prophet(quantity) Test 3.1128577 10.37381 6.296657 NaN Inf 0.5961035 0.5098812 0.5241731
SNAIVE(quantity) Test 0.3666667 12.70827 5.300000 -Inf Inf 0.5017502 0.6246215 0.0532605
Cross validation- daily

Cross validated accuracy for a variety of models using daily data.

.model .type ME RMSE MAE MPE MAPE MASE RMSSE ACF1
ARIMA(quantity) Test -0.0893772 0.0893787 0.0893772 -Inf Inf 0.0525763 0.0120319 0.0363889
ETS(quantity ~ season(method = “A”)) Test -0.0719456 0.7260574 0.5607913 NaN Inf 0.3298861 0.0977400 0.2397081
FASSTER(quantity ~ trend(1) + fourier(7)) Test 0.0982023 0.7376932 0.6125365 NaN Inf 0.3603253 0.0993064 0.2392553
prophet(quantity ~ season(7)) Test -0.4070273 0.8338570 0.7029038 NaN Inf 0.4134839 0.1122517 0.2171465
SNAIVE(quantity ~ lag(“week”)) Test 0.0000000 0.0000000 0.0000000 NaN NaN 0.0000000 0.0000000 NaN

Site B

Seasonality
Week

Year

Raw data

Detail of data

Weekly totals

Detail of weekly totals

Residuals of STL model- raw data and weekly totals

Simple exponential smoothing
.model term estimate
ETS(quantity ~ season(method = “N”)) alpha 0.0807574
ETS(quantity ~ season(method = “N”)) l[0] 17.8629306

Ljung Box test for autocorrelation of residuals

.model lb_stat lb_pvalue
ETS(quantity ~ season(method = “N”)) 26.27242 0.0033906
ARIMA
.model term estimate std.error statistic p.value
ARIMA(quantity) ar1 -0.1995096 0.0747021 -2.670737 0.0079493
ARIMA(quantity) ma1 -0.8003094 0.0616738 -12.976498 0.0000000

Ljung Box test for autocorrelation of residuals

.model lb_stat lb_pvalue
ARIMA(quantity) 16.76456 0.0797388
Model testing
Weekly data

.model .type ME RMSE MAE MPE MAPE MASE RMSSE
ARIMA(quantity) Test 11.6770 18.153 13.893 -Inf Inf 0.43867 0.36003
ETS(quantity ~ season(method = “N”)) Test 7.0046 15.509 13.833 -Inf Inf 0.43677 0.30760
FASSTER(quantity ~ trend(1)) Test 13.7510 19.508 13.833 -Inf Inf 0.43677 0.38691
prophet(quantity) Test 9.4603 14.890 12.551 NaN Inf 0.39629 0.29531
SNAIVE(quantity) Test 4.5000 19.803 14.167 -Inf Inf 0.44730 0.39276
Daily data

.model .type ME RMSE MAE MPE MAPE MASE RMSSE
ARIMA(quantity) Test 1.7259 8.3257 3.3840 -Inf Inf 0.64965 0.50892
ETS(quantity ~ season(method = “A”)) Test 2.1609 8.6052 4.3626 NaN Inf 0.83752 0.52600
FASSTER(quantity ~ trend(1) + fourier(7)) Test 1.9376 8.5445 4.4014 NaN Inf 0.84498 0.52229
prophet(quantity ~ season(7)) Test 1.6884 8.5148 4.4845 NaN Inf 0.86093 0.52047
SNAIVE(quantity ~ lag(“week”)) Test 2.6429 8.5649 2.6429 100 100 0.50737 0.52353
Cross validation

Cross validated accuracy for a variety of models using weekly data.

## Warning in sqrt(diag(best$var.coef)): NaNs produced

## Warning in sqrt(diag(best$var.coef)): NaNs produced
.model .type ME RMSE MAE MPE MAPE MASE RMSSE ACF1
ARIMA(quantity) Test 3.206373 16.10325 12.67050 NaN Inf 0.4000581 0.3193783 0.1996702
ETS(quantity ~ season(method = “N”)) Test 1.404502 15.58327 12.80260 -Inf Inf 0.4042292 0.3090654 0.2580917
FASSTER(quantity ~ trend(1)) Test 4.778155 16.04366 11.23543 -Inf Inf 0.3547474 0.3181964 0.2507581
prophet(quantity) Test 3.903188 21.68447 15.36338 NaN Inf 0.4850831 0.4300714 0.5727373
SNAIVE(quantity) Test 1.583333 29.88101 14.54167 -Inf Inf 0.4591384 0.5926348 0.1209607
Cross validation- daily

Cross validated accuracy for a variety of models using daily data.

.model .type ME RMSE MAE MPE MAPE MASE RMSSE ACF1
ARIMA(quantity) Test -1.5823089 1.582480 1.582309 -Inf Inf 0.2973949 0.0957098 0.8575486
ETS(quantity ~ season(method = “A”)) Test -1.1804705 2.455482 2.242985 NaN Inf 0.4215688 0.1485097 0.4013534
FASSTER(quantity ~ trend(1) + fourier(7)) Test 0.6727588 2.271434 1.665238 NaN Inf 0.3129813 0.1373784 0.3924931
prophet(quantity ~ season(7)) Test -1.4721508 2.648072 2.338106 NaN Inf 0.4394469 0.1601578 0.4024566
SNAIVE(quantity ~ lag(“week”)) Test 0.0000000 0.000000 0.000000 NaN NaN 0.0000000 0.0000000 NaN

Site C

Seasonality
Week

Year

Raw data

Detail of data

Weekly totals

Detail of weekly totals

Residuals of STL model- raw data and weekly totals

Simple exponential smoothing
.model term estimate
ETS(quantity ~ season(method = “N”)) alpha 0.0532616
ETS(quantity ~ season(method = “N”)) l[0] 107.9514229

Ljung Box test for autocorrelation of residuals

.model lb_stat lb_pvalue
ETS(quantity ~ season(method = “N”)) 54.70743 0
ARIMA
.model term estimate std.error statistic p.value
ARIMA(quantity) ma1 -0.9448022 0.0233496 -40.4633198 0.0000000
ARIMA(quantity) sar1 0.0429685 0.0583445 0.7364621 0.4619792
ARIMA(quantity) sar2 0.0936337 0.0661773 1.4148925 0.1580545

Ljung Box test for autocorrelation of residuals

.model lb_stat lb_pvalue
ARIMA(quantity) 46.8145 1e-06
Model testing
Weekly data

.model .type ME RMSE MAE MPE MAPE MASE RMSSE
ARIMA(quantity) Test -38.4020 39.304 38.402 -Inf Inf 0.70652 0.55721
ETS(quantity ~ season(method = “N”)) Test -41.1820 42.508 41.182 -Inf Inf 0.75768 0.60264
FASSTER(quantity ~ trend(1)) Test -6.4169 12.250 12.056 -Inf Inf 0.22180 0.17367
prophet(quantity) Test -6.3233 12.483 9.919 NaN Inf 0.18249 0.17697
SNAIVE(quantity) Test -28.0000 48.497 37.333 -Inf Inf 0.68687 0.68755
Daily data

.model .type ME RMSE MAE MPE MAPE MASE RMSSE
ARIMA(quantity) Test 2.27100 9.7607 2.2710 Inf Inf 0.17621 0.36743
ETS(quantity ~ season(method = “A”)) Test -3.40430 11.0670 7.0533 NaN Inf 0.54725 0.41661
FASSTER(quantity ~ trend(1) + fourier(7)) Test -0.96906 11.7240 8.0877 NaN Inf 0.62751 0.44135
prophet(quantity ~ season(7)) Test -2.53810 11.9630 8.2687 NaN Inf 0.64155 0.45035
SNAIVE(quantity ~ lag(“week”)) Test 2.00000 9.6609 2.0000 100 100 0.15518 0.36367
Cross validation

Cross validated accuracy for a variety of models using weekly data.

.model .type ME RMSE MAE MPE MAPE MASE RMSSE ACF1
ARIMA(quantity) Test -4.0076500 37.93353 32.39679 -Inf Inf 0.5949660 0.5369396 0.3968519
ETS(quantity ~ season(method = “N”)) Test -3.9285852 37.50104 31.85796 -Inf Inf 0.5850705 0.5308179 0.3922062
FASSTER(quantity ~ trend(1)) Test 0.0330934 34.85186 27.56318 -Inf Inf 0.5061970 0.4933193 0.3145006
prophet(quantity) Test 5.8843990 41.56972 31.98042 NaN Inf 0.5873195 0.5884090 0.4235530
SNAIVE(quantity) Test -3.5000000 59.67132 44.33333 -Inf Inf 0.8141803 0.8446326 0.4159235
Cross validation- daily

Cross validated accuracy for a variety of models using daily data.

.model .type ME RMSE MAE MPE MAPE MASE RMSSE ACF1
ARIMA(quantity) Test -40.378875 41.384168 40.378875 -Inf Inf 3.0791736 1.5415404 0.0041697
ETS(quantity ~ season(method = “A”)) Test -4.766195 9.703612 7.659677 -Inf Inf 0.5841043 0.3614549 -0.0681954
FASSTER(quantity ~ trend(1) + fourier(7)) Test -11.052605 15.195554 13.074809 -Inf Inf 0.9970463 0.5660271 0.0831263
prophet(quantity ~ season(7)) Test -3.250503 10.993322 8.756318 NaN Inf 0.6677309 0.4094960 0.0889073
SNAIVE(quantity ~ lag(“week”)) Test -5.333333 22.861904 10.666667 -Inf Inf 0.8134084 0.8515950 -0.1200754