1 Introduction

Our dataset contains retail data of a global superstore, over the duration of 4 years. Our goal is to predict the next 7 days from the last date of our data.

2 Data Wrangling

2.1 Import & Inspect Data

data <- read.csv("train.csv")
tail(data)
glimpse(data)
## Rows: 9,800
## Columns: 18
## $ Row.ID        <int> 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 1…
## $ Order.ID      <chr> "CA-2017-152156", "CA-2017-152156", "CA-2017-138688", "U…
## $ Order.Date    <chr> "08/11/2017", "08/11/2017", "12/06/2017", "11/10/2016", …
## $ Ship.Date     <chr> "11/11/2017", "11/11/2017", "16/06/2017", "18/10/2016", …
## $ Ship.Mode     <chr> "Second Class", "Second Class", "Second Class", "Standar…
## $ Customer.ID   <chr> "CG-12520", "CG-12520", "DV-13045", "SO-20335", "SO-2033…
## $ Customer.Name <chr> "Claire Gute", "Claire Gute", "Darrin Van Huff", "Sean O…
## $ Segment       <chr> "Consumer", "Consumer", "Corporate", "Consumer", "Consum…
## $ Country       <chr> "United States", "United States", "United States", "Unit…
## $ City          <chr> "Henderson", "Henderson", "Los Angeles", "Fort Lauderdal…
## $ State         <chr> "Kentucky", "Kentucky", "California", "Florida", "Florid…
## $ Postal.Code   <int> 42420, 42420, 90036, 33311, 33311, 90032, 90032, 90032, …
## $ Region        <chr> "South", "South", "West", "South", "South", "West", "Wes…
## $ Product.ID    <chr> "FUR-BO-10001798", "FUR-CH-10000454", "OFF-LA-10000240",…
## $ Category      <chr> "Furniture", "Furniture", "Office Supplies", "Furniture"…
## $ Sub.Category  <chr> "Bookcases", "Chairs", "Labels", "Tables", "Storage", "F…
## $ Product.Name  <chr> "Bush Somerset Collection Bookcase", "Hon Deluxe Fabric …
## $ Sales         <dbl> 261.9600, 731.9400, 14.6200, 957.5775, 22.3680, 48.8600,…

Features for Analysis: - Order.Date : datetime column - Sales: numerical value column

# adjusting datatype
data$Order.Date <- dmy(data$Order.Date)
store <- data %>% select(Order.Date,Sales)
#arrange date and aggregate sales
store <- store %>% arrange(Order.Date)
store_agg <- store %>% group_by(Order.Date) %>% 
               summarize(Sales = sum(Sales)) %>% 
               ungroup()

2.2 Check for time intervals and missing values

Check for missing time intervals

full_date = seq(from = min(store_agg$Order.Date), max(store_agg$Order.Date), by = "day")
all(full_date == store_agg$Order.Date)
## Warning in `==.default`(full_date, store_agg$Order.Date): longer object length
## is not a multiple of shorter object length
## [1] FALSE

There are gaps between time intervals in our data, padding is needed.

store_agg <- store_agg %>% pad()
## pad applied on the interval: day

Check for missing values

anyNA(store_agg)
## [1] TRUE
#fill missing values
store_agg <- store_agg %>% 
                mutate(Sales = na.fill(Sales, fill="extend"))
range(store_agg$Order.Date)
## [1] "2015-01-03" "2018-12-30"

3 EDA

#make ts object
store_ts <- ts(store_agg$Sales,
               start=2015,
               frequency=365)
autoplot(store_ts)

Insight: - data seems to have multiplicative seasonality with a slight increasing trend - the number of sales in this store is fluctuative - the highest peak of sales occured in early 2015 - there are also noticeable peaks of sales nearing the end of each year, this could be explained by the holiday season that occurs around this time of year

store_ts %>% decompose(type= "multiplicative") %>% autoplot()

4 Model

4.1 Cross-Validation

# Data Train
train <- head(store_ts, -365)

# Data Test
test <- tail(store_ts, 365)

4.2 Build Model

Since our data has both seasonality and trend, we can use triple exponential smoothing, with the function HoltWinters()

store_hw <- HoltWinters(train,seasonal = "multiplicative")
store_hw$fitted[,1]
## Time Series:
## Start = c(2016, 1) 
## End = c(2017, 363) 
## Frequency = 365 
##   [1]  1768.904208   264.679581   295.976310    31.544571   142.412154
##   [6]   253.363933   363.935995  1021.276798   885.482789   747.374552
##  [11]   620.152934   551.502840   482.213063   412.660259   345.466270
##  [16]   321.414237   298.626079   234.438176   170.498073   107.091126
##  [21]    43.628341    13.297426    99.718246   185.924916  3636.622081
##  [26]  4378.332682  3296.389359  2207.520647   100.705169   233.727475
##  [31]   366.195760   500.695216  1161.584602  1821.180571  2487.661213
##  [36]   333.267036   133.433983   807.561557    79.336074   337.632878
##  [41]   596.511303   855.102880  1113.038626  1652.375571   164.529078
##  [46]   136.673571   108.734131   217.153038   324.720138  2641.933063
##  [51]    80.982891    38.462631    32.056639    26.066052   598.819678
##  [56]  1173.118164   552.030248  1097.871357  1639.736411   894.665037
##  [61]  1251.158183  1600.037700  1947.546160  1535.774427   796.147718
##  [66]  2538.736448   483.240364    92.591991    72.409884    51.917952
##  [71]  1416.922644   724.979314    17.272893  7400.042642    49.749194
##  [76]  2678.891318  5244.451020   104.346890  1304.594881  2552.011518
##  [81]   644.298034   427.118839   279.893773   133.961123    85.206700
##  [86]   246.345987  1572.632895   583.711455   205.041174   254.793171
##  [91]   304.644018   907.289400  1511.306060  3025.458879   142.313532
##  [96]   921.610458   845.180825   769.293584   172.023859  1346.456896
## [101]  2287.033204  3228.709164    35.877237  2131.923812  4203.956960
## [106]  2768.961787  2035.670592   334.806352  1210.712418   906.010113
## [111]   155.069499    90.723738    26.248670   928.758221  2103.799713
## [116]  2730.187661  4065.361070     8.048667  1598.812122   461.458258
## [121]   171.573103  2251.434404  1142.209808   871.484722   592.314029
## [126]   313.799635  4098.028355    49.968465   154.995770   191.710219
## [131]  1067.222725   240.061836  3162.021168    70.125864   256.391302
## [136]    47.498181    11.040616    91.609948   173.715337    74.084746
## [141]  3943.278927  1325.989641   620.943466  1776.590024  1009.511414
## [146]   915.545409   816.379939  1149.206891   697.316658  5275.581956
## [151]   855.940898   968.512924  1081.453280  1197.542587  1533.453552
## [156]   798.104661    59.279965   144.235682   788.423875  2064.398245
## [161]  3337.336719   173.642519  1121.003653    51.330858   738.844101
## [166]  3456.400630  2673.061641  1889.018801   449.782997   837.147658
## [171]   109.121265  2030.830807   842.520534   855.342134   856.644171
## [176]  1584.883655  1358.785247  1120.606715   432.327010   832.117876
## [181]  1235.980372  1643.398538   536.240961  1403.183252  1008.974968
## [186]   234.200861   746.728183   259.778176  1118.688176  1976.338606
## [191]  1911.871484   342.012887   285.426550     9.325309    95.366801
## [196]   181.286801   267.188292   451.251083  2234.559181  1917.574284
## [201]  1323.848913  2573.011800  5400.400274  8223.297051  4971.583620
## [206]   572.799030   191.032211   767.420498  1334.339705   774.103513
## [211]   220.680561   856.792929   462.236297  2651.710963  2326.517632
## [216]   253.433333  2027.527182  3787.733219  3451.372586  1941.218972
## [221]   432.034197  1481.920260  1099.032412   711.126977   323.913500
## [226]   817.924328   478.316299   926.682071  1374.882666  1756.254849
## [231]   888.833081    22.048499   536.883911    56.732264  1378.343908
## [236]   348.262019  1965.292268  1376.214125   787.629497   114.829969
## [241]    87.789533   444.134692  3080.831473    20.869103   150.205199
## [246]   279.135793    94.535307  3321.778270 13374.583730  3802.259242
## [251]  1746.836582   120.724125  4640.686059  1208.167861  4755.497762
## [256]   126.398918    31.596704   812.607450  5011.191263  9163.806689
## [261]  5274.118822  2644.365797  1220.347577 10479.001429   208.309464
## [266]   348.656081  1304.985234   762.614279   483.950873  7997.562512
## [271]   976.335619     4.655378   592.460667   855.445344   721.996287
## [276]   191.408263   492.173841   236.503409   147.131167   249.407184
## [281]  2054.036460  1388.678667    58.901960  2219.221728  4516.297238
## [286]   206.380806   193.234980   134.384429  3085.952633   628.934376
## [291]  1474.932292  1331.943510   219.458994   137.533883    55.574725
## [296]   102.631830   441.918322    21.993620  1487.936850  2754.683239
## [301]  4009.206871  5250.527948  4541.320285  2081.530445  2715.132866
## [306]  6516.802579  1647.793920  1458.349083  1270.866327   323.328550
## [311]  1531.949364  1954.021881  7653.768341   880.209625   945.185619
## [316]  1004.805244  1729.814024  1316.546780 11226.052816  3313.054755
## [321]  7029.279129   889.387583  1224.705366  1074.185897  1324.280459
## [326]  5407.984477  4281.336888  1657.436871   197.601007  2213.848251
## [331]   630.837314   213.018107  5466.397873  1721.540029   491.092913
## [336]   126.024472  2871.674821  1909.043553   530.609300  1064.198048
## [341]  1494.003665   562.167667  2693.174287  4797.289545   284.659454
## [346]  7407.040191  1227.500253  3946.503049    44.188083  1681.736608
## [351]  3313.699328  6729.254315  1879.683089   779.329054   915.634117
## [356]  1892.299084  1936.137517  1979.601307  2871.118905  2597.240402
## [361]  2002.194230  2100.289797  5075.584573  3463.496430  1857.450823
## [366]  1697.541822   253.932287   283.690364    30.274815   136.678760
## [371]   243.113624   349.403650   978.429778   848.368604   717.431877
## [376]   596.480589   530.978311   465.234294   399.391237   334.442406
## [381]   311.199094   288.434802   226.632284   164.924211   103.418685
## [386]    41.892574    12.659642    94.663303   176.585080  3453.525567
## [391]  4155.320723  3124.987671  2092.040658    95.813002   222.417854
## [396]   348.811663   475.973739  1101.934528  1727.399565  2355.466782
## [401]   314.525725   125.537213   762.245433    74.922246   318.387231
## [406]   562.070275   805.642403  1048.963846  1556.727600   155.515204
## [411]   129.108808   102.670864   205.002959   307.011453  2505.840722
## [416]    76.773321    36.512022    30.627467    24.900313   571.022539
## [421]  1117.724835   529.301377  1052.879479  1574.946711   861.387212
## [426]  1203.521557  1542.768968  1881.493918  1485.040636   770.598304
## [431]  2450.418403   460.672673    87.885602    68.649027    49.295285
## [436]  1341.011960   685.745417    16.285797  7002.120975    47.208891
## [441]  2540.016990  5008.720942    99.063848  1231.931191  2407.734550
## [446]   611.833984   401.600347   264.010026   126.910459    80.881408
## [451]   234.626243  1501.067877   552.815280   194.222928   241.667936
## [456]   289.149935   861.590115  1434.544235  2872.976762   135.203238
## [461]   876.014763   803.671675   731.534668   163.606035  1281.326967
## [466]  2178.859148  3076.799319    34.032925  2026.056719  4008.968261
## [471]  2642.724409  1936.366796   318.400178  1152.273280   861.718641
## [476]   147.521633    86.301148    25.032275   886.492610  2010.375140
## [481]  2613.100334  3887.964395     7.674717  1518.080573   436.592024
## [486]   162.077015  2129.305463  1083.657260   823.246995   559.641269
## [491]   296.286538  3863.919668    47.262740   148.367284   184.058157
## [496]  1019.795975   229.315966  3021.207801    67.144279   245.705716
## [501]    45.488335    10.486088    87.060991   164.216757    70.048755
## [506]  3735.471686  1259.742723   589.461335  1682.594707   952.713712
## [511]   862.432926   770.184429  1085.263071   659.463166  5003.832745
## [516]   808.402123   920.325182  1032.386626  1145.639186  1470.726066
## [521]   764.589429    57.143600   139.083924   761.280993  1992.262947
## [526]  3222.083832   167.034644  1079.798610    49.083688   705.929939
## [531]  3307.918661  2558.275663  1808.373356   429.403535   798.512551
## [536]   103.995241  1940.900626   804.839249   815.530003   821.859820
## [541]  1524.298591  1303.424334  1077.979212   414.984324   798.335557
## [546]  1183.224429  1569.455602   681.327491  1191.958376   452.555359
## [551]   889.648389   689.289820   110.595510  1344.782933   773.234625
## [556]  1850.995715  1320.962241  1288.326633   503.280744  1165.228723
## [561]  1827.124357   361.238094   475.974333   846.990804  2289.133174
## [566]  1583.589292  1575.603953  2164.990090  3417.863465  3271.975051
## [571]   773.378329    89.701996   387.933400   682.577910   550.596340
## [576]  2238.213284   911.515075   923.989580  1517.053518  1158.344165
## [581]   138.088546  1054.617546  1995.551126  1747.454626  3566.197847
## [586]   657.719999   674.692873   643.184130   609.776686   437.309157
## [591]   598.356970  2142.141326   572.215434  1096.729778  1595.947234
## [596]  1622.544901  1649.383453   241.857333   719.243051  4697.284495
## [601]   235.410151   981.272427   892.238365  4065.368226   186.514711
## [606]   859.735740  1678.037507  2539.910831  1238.948255  1144.929085
## [611]   727.343987   577.871043  1790.766933  6757.385183  1490.880255
## [616]  1097.841281   867.265076  2894.780215   867.952471  3023.673070
## [621]  1941.056961  1483.537178   325.555934  8584.281380  5744.910717
## [626]  2286.107131  2066.082874  4513.421381  5000.167807  1809.276209
## [631]  2557.877206  2254.230117  2448.523601  1565.895738  3640.301465
## [636]  1002.919266   654.600328   896.362631  1060.189112   432.884047
## [641]   365.790200   680.074518   461.679121   306.207892   223.251532
## [646]  2015.143435  1601.774254   609.425362  2226.862780  1924.424065
## [651]  1119.947539  1941.178714   529.510950  1212.758211   457.564917
## [656]  1796.844872   921.735677   296.319413    60.812041  1333.616502
## [661]   521.059701   994.213171   817.885064   998.031484  1102.814046
## [666]  1658.499206  3217.584677  3581.054125  2589.580890  4234.713053
## [671]  4090.397993  1678.053087  1036.080304   487.446049  1905.192643
## [676]  7655.724814  3419.702787  4947.402307   647.530250  1011.965024
## [681]  2043.916838  2112.108586   905.399419  6609.251832  3507.685666
## [686]  4088.189596   940.230677  2123.107981  2502.654788   857.434177
## [691]  4047.241562  2326.559919   634.582022   935.671747  2641.434124
## [696]  1320.213512  1681.743158  3111.003153  4787.594656  2826.103880
## [701]  1191.972818  4094.441269  1242.630538  3716.842845  1178.849854
## [706]  2115.483401   232.374508  2805.512597  2737.380148   948.092618
## [711]  3395.287880   747.789655  4679.985746    19.602252  1748.905314
## [716]  1795.861092  6095.442613  1353.322867  2184.374388   620.853318
## [721]   828.425521  5073.525570  3187.700511  1411.584841  3968.503666
## [726]   803.197785  1760.231844  3805.446605

4.3 Forecast

store_forecast <- forecast(store_hw, h = 365)
store_forecast
##           Point Forecast         Lo 80     Hi 80        Lo 95     Hi 95
## 2017.9945     2111.11396    360.710878  3861.517   -565.89654  4788.124
## 2017.9973     1220.81056   -529.592520  2971.214  -1456.19994  3897.821
## 2018.0000      877.45357   -872.949510  2627.857  -1799.55693  3554.464
## 2018.0027     1311.61095   -438.792130  3062.014  -1365.39955  3988.621
## 2018.0055      727.43239  -1022.970686  2477.835  -1949.57810  3404.443
## 2018.0082      159.87172  -1590.531358  1910.275  -2517.13878  2836.882
## 2018.0110      150.13871  -1600.264366  1900.542  -2526.87178  2827.149
## 2018.0137      140.41749  -1609.985584  1890.821  -2536.59300  2817.428
## 2018.0164     1210.41958   -539.983503  2960.823  -1466.59092  3887.430
## 2018.0192      800.98572   -949.417356  2551.389  -1876.02477  3477.996
## 2018.0219      422.19598  -1328.207100  2172.599  -2254.81452  3099.206
## 2018.0247      357.99825  -1392.404826  2108.401  -2319.01224  3035.009
## 2018.0274      361.72567  -1388.677412  2112.129  -2315.28483  3038.736
## 2018.0301      386.42304  -1363.980041  2136.826  -2290.58746  3063.434
## 2018.0329      411.02874  -1339.374340  2161.432  -2265.98176  3088.039
## 2018.0356      558.13033  -1192.272753  2308.533  -2118.88017  3235.141
## 2018.0384      185.76142  -1564.641658  1936.164  -2491.24908  2862.772
## 2018.0411      721.16094  -1029.242141  2471.564  -1955.84956  3398.171
## 2018.0438      730.89028  -1019.512796  2481.293  -1946.12021  3407.901
## 2018.0466      725.85629  -1024.546785  2476.259  -1951.15420  3402.867
## 2018.0493      720.85807  -1029.545007  2471.261  -1956.15242  3397.869
## 2018.0521      715.93650  -1034.466582  2466.340  -1961.07400  3392.947
## 2018.0548      548.01341  -1202.389673  2298.416  -2128.99709  3225.024
## 2018.0575     1009.41365   -740.989425  2759.817  -1667.59684  3686.424
## 2018.0603       53.98504  -1696.418038  1804.388  -2623.02546  2730.996
## 2018.0630      564.77237  -1185.630712  2315.175  -2112.23813  3241.783
## 2018.0658     1645.65224   -104.750835  3396.055  -1031.35825  4322.663
## 2018.0685     1752.70785      2.304770  3503.111   -924.30265  4429.718
## 2018.0712     1204.74645   -545.656629  2955.150  -1472.26405  3881.757
## 2018.0740     1703.61869    -46.784389  3454.022   -973.39181  4380.629
## 2018.0767     1838.21852     87.815445  3588.622   -838.79197  4515.229
## 2018.0795     1012.87187   -737.531209  2763.275  -1664.13863  3689.882
## 2018.0822      225.83110  -1524.571982  1976.234  -2451.17940  2902.842
## 2018.0849     5397.30084   3646.897763  7147.704   2720.29034  8074.311
## 2018.0877      919.12169   -831.281391  2669.525  -1757.88881  3596.132
## 2018.0904      767.94897   -982.454111  2518.352  -1909.06153  3444.959
## 2018.0932     2627.19602    876.792939  4377.599    -49.81448  5304.207
## 2018.0959      195.61093  -1554.792151  1946.014  -2481.39957  2872.621
## 2018.0986      489.43195  -1260.971126  2239.835  -2187.57854  3166.442
## 2018.1014     1082.37924   -668.023834  2832.782  -1594.63125  3759.390
## 2018.1041       98.97842  -1651.424660  1849.381  -2578.03208  2775.989
## 2018.1068      175.99179  -1574.411285  1926.395  -2501.01870  2853.002
## 2018.1096      253.08685  -1497.316231  2003.490  -2423.92365  2930.097
## 2018.1123     1096.77457   -653.628506  2847.178  -1580.23592  3773.785
## 2018.1151      481.77825  -1268.624833  2232.181  -2195.23225  3158.789
## 2018.1178     1074.52486   -675.878216  2824.928  -1602.48563  3751.535
## 2018.1205      294.85289  -1455.550185  2045.256  -2382.15760  2971.863
## 2018.1233      707.33851  -1043.064569  2457.742  -1969.67199  3384.349
## 2018.1260      553.72933  -1196.673747  2304.132  -2123.28116  3230.740
## 2018.1288      448.81181  -1301.591270  2199.215  -2228.19869  3125.822
## 2018.1315      343.77299  -1406.630092  2094.176  -2333.23751  3020.783
## 2018.1342      957.05601   -793.347071  2707.459  -1719.95449  3634.067
## 2018.1370      912.79799   -837.605092  2663.201  -1764.21251  3589.808
## 2018.1397      583.89679  -1166.506284  2334.300  -2093.11370  3260.907
## 2018.1425       44.96575  -1705.437331  1795.369  -2632.04475  2721.976
## 2018.1452       39.65266  -1710.750420  1790.056  -2637.35784  2716.663
## 2018.1479      242.99572  -1507.407360  1993.399  -2434.01478  2920.006
## 2018.1507      506.86736  -1243.535719  2257.270  -2170.14314  3183.878
## 2018.1534      341.54583  -1408.857248  2091.949  -2335.46467  3018.556
## 2018.1562      483.66521  -1266.737865  2234.068  -2193.34528  3160.676
## 2018.1589     4240.17702   2489.773940  5990.580   1563.16652  6917.188
## 2018.1616     4254.07697   2503.673896  6004.480   1577.06648  6931.087
## 2018.1644     4667.12603   2916.722954  6417.529   1990.11554  7344.137
## 2018.1671      766.20990   -984.193174  2516.613  -1910.80059  3443.220
## 2018.1699      805.50028   -944.902802  2555.903  -1871.51022  3482.511
## 2018.1726     1031.87883   -718.524250  2782.282  -1645.13167  3708.889
## 2018.1753      303.56884  -1446.834241  2053.972  -2373.44166  2980.579
## 2018.1781     2196.71123    446.308148  3947.114   -480.29927  4873.722
## 2018.1808      542.69605  -1207.707028  2293.099  -2134.31445  3219.707
## 2018.1836     4601.92235   2851.519272  6352.325   1924.91185  7278.933
## 2018.1863      545.46834  -1204.934740  2295.871  -2131.54216  3222.479
## 2018.1890     1001.18611   -749.216964  2751.589  -1675.82438  3678.197
## 2018.1918     5647.96794   3897.564864  7398.371   2970.95745  8324.978
## 2018.1945      647.35410  -1103.048981  2397.757  -2029.65640  3324.365
## 2018.1973     1053.25045   -697.152632  2803.654  -1623.76005  3730.261
## 2018.2000     3855.05804   2104.654962  5605.461   1178.04754  6532.069
## 2018.2027     1386.32850   -364.074575  3136.732  -1290.68199  4063.339
## 2018.2055     1575.82822   -174.574856  3326.231  -1101.18227  4252.839
## 2018.2082     1974.00627    223.603194  3724.409   -703.00422  4651.017
## 2018.2110      575.66232  -1174.740763  2326.065  -2101.34818  3252.673
## 2018.2137      840.10206   -910.301022  2590.505  -1836.90844  3517.113
## 2018.2164     1041.55588   -708.847197  2791.959  -1635.45461  3718.566
## 2018.2192      513.14183  -1237.261246  2263.545  -2163.86866  3190.152
## 2018.2219      584.19699  -1166.206089  2334.600  -2092.81351  3261.207
## 2018.2247      880.72681   -869.676264  2631.130  -1796.28368  3557.737
## 2018.2274      443.51442  -1306.888656  2193.918  -2233.49607  3120.525
## 2018.2301       84.31998  -1666.083097  1834.723  -2592.69051  2761.330
## 2018.2329      161.34169  -1589.061385  1911.745  -2515.66880  2838.352
## 2018.2356     2109.21077    358.807688  3859.614   -567.79973  4786.221
## 2018.2384      215.56058  -1534.842498  1965.964  -2461.44992  2892.571
## 2018.2411      444.89981  -1305.503267  2195.303  -2232.11068  3121.910
## 2018.2438     1344.45191   -405.951174  3094.855  -1332.55859  4021.462
## 2018.2466      952.76548   -797.637595  2703.169  -1724.24501  3629.776
## 2018.2493      581.48563  -1168.917449  2331.889  -2095.52487  3258.496
## 2018.2521     1104.75124   -645.651836  2855.154  -1572.25925  3781.762
## 2018.2548     1692.65434    -57.748735  3443.057   -984.35615  4369.665
## 2018.2575      801.70739   -948.695691  2552.110  -1875.30311  3478.718
## 2018.2603     1432.79916   -317.603915  3183.202  -1244.21133  4109.810
## 2018.2630     1988.69952    238.296442  3739.103   -688.31098  4665.710
## 2018.2658      923.03123   -827.371853  2673.434  -1753.97927  3600.042
## 2018.2685      612.91656  -1137.486523  2363.320  -2064.09394  3289.927
## 2018.2712     1207.00596   -543.397117  2957.409  -1470.00453  3884.016
## 2018.2740     1717.85466    -32.548415  3468.258   -959.15583  4394.865
## 2018.2767     1166.61781   -583.785273  2917.021  -1510.39269  3843.628
## 2018.2795      863.03629   -887.366790  2613.439  -1813.97421  3540.047
## 2018.2822     2042.27678    291.873698  3792.680   -634.73372  4719.287
## 2018.2849     6926.91063   5176.507556  8677.314   4249.90014  9603.921
## 2018.2877     1243.06277   -507.340310  2993.466  -1433.94773  3920.073
## 2018.2904     2189.60030    439.197224  3940.003   -487.41019  4866.611
## 2018.2932      940.10673   -810.296352  2690.510  -1736.90377  3617.117
## 2018.2959      924.15749   -826.245586  2674.561  -1752.85300  3601.168
## 2018.2986      483.17757  -1267.225511  2233.581  -2193.83293  3160.188
## 2018.3014     1079.16027   -671.242811  2829.563  -1597.85023  3756.171
## 2018.3041      450.19921  -1300.203873  2200.602  -2226.81129  3127.210
## 2018.3068      941.04979   -809.353287  2691.453  -1735.96070  3618.060
## 2018.3096      397.93261  -1352.470469  2148.336  -2279.07789  3074.943
## 2018.3123     1011.84596   -738.557123  2762.249  -1665.16454  3688.856
## 2018.3151     1254.74108   -495.661994  3005.144  -1422.26941  3931.752
## 2018.3178     1751.69140      1.288317  3502.094   -925.31910  4428.702
## 2018.3205      185.16769  -1565.235388  1935.571  -2491.84281  2862.178
## 2018.3233      656.23532  -1094.167755  2406.638  -2020.77517  3333.246
## 2018.3260      465.20286  -1285.200215  2215.606  -2211.80763  3142.213
## 2018.3288      506.03312  -1244.369964  2256.436  -2170.97738  3183.044
## 2018.3315     1441.85807   -308.545012  3192.261  -1235.15243  4118.869
## 2018.3342     1510.99393   -239.409153  3261.397  -1166.01657  4188.004
## 2018.3370     1876.92571    126.522626  3627.329   -800.08479  4553.936
## 2018.3397      348.87686  -1401.526219  2099.280  -2328.13364  3025.887
## 2018.3425     2915.06984   1164.666761  4665.473    238.05934  5592.080
## 2018.3452     2237.26790    486.864822  3987.671   -439.74260  4914.278
## 2018.3479      761.81973   -988.583349  2512.223  -1915.19077  3438.830
## 2018.3507      498.34050  -1252.062579  2248.744  -2178.67000  3175.351
## 2018.3534       73.03250  -1677.370582  1823.436  -2603.97800  2750.043
## 2018.3562      918.03555   -832.367532  2668.439  -1758.97495  3595.046
## 2018.3589      485.09969  -1265.303391  2235.503  -2191.91081  3162.110
## 2018.3616     1406.13579   -344.267289  3156.539  -1270.87471  4083.146
## 2018.3644      401.49151  -1348.911571  2151.895  -2275.51899  3078.502
## 2018.3671      603.18281  -1147.220271  2353.586  -2073.82769  3280.193
## 2018.3699      218.26870  -1532.134377  1968.672  -2458.74179  2895.279
## 2018.3726       74.80170  -1675.601380  1825.205  -2602.20880  2751.812
## 2018.3753      949.82891   -800.574172  2700.232  -1727.18159  3626.839
## 2018.3781     1494.76667   -255.636413  3245.170  -1182.24383  4171.777
## 2018.3808     1601.92267   -148.480411  3352.326  -1075.08783  4278.933
## 2018.3836     2454.56595    704.162870  4204.969   -222.44455  5131.576
## 2018.3863     6597.07076   4846.667683  8347.474   3920.06027  9274.081
## 2018.3890      383.75906  -1366.644015  2134.162  -2293.25143  3060.770
## 2018.3918     1396.29374   -354.109342  3146.697  -1280.71676  4073.304
## 2018.3945     1504.92471   -245.478366  3255.328  -1172.08578  4181.935
## 2018.3973     3400.60971   1650.206628  5151.013    723.59921  6077.620
## 2018.4000     1529.79826   -220.604823  3280.201  -1147.21224  4206.809
## 2018.4027     1026.33195   -724.071133  2776.735  -1650.67855  3703.342
## 2018.4055     4938.22200   3187.818920  6688.625   2261.21150  7615.232
## 2018.4082     2145.39161    394.988536  3895.795   -531.61888  4822.402
## 2018.4110      478.42105  -1271.982033  2228.824  -2198.58945  3155.432
## 2018.4137      439.28442  -1311.118656  2189.688  -2237.72607  3116.295
## 2018.4164     1107.16360   -643.239481  2857.567  -1569.84690  3784.174
## 2018.4192     1775.48599     25.082915  3525.889   -901.52450  4452.496
## 2018.4219      938.19701   -812.206067  2688.600  -1738.81348  3615.208
## 2018.4247     3463.29786   1712.894786  5213.701    786.28737  6140.308
## 2018.4274       51.47708  -1698.926002  1801.880  -2625.53342  2728.488
## 2018.4301      556.76621  -1193.636870  2307.169  -2120.24429  3233.777
## 2018.4329     1266.21422   -484.188859  3016.617  -1410.79628  3943.225
## 2018.4356     1571.40160   -179.001483  3321.805  -1105.60890  4248.412
## 2018.4384     2158.43213    408.029051  3908.835   -518.57837  4835.443
## 2018.4411     1779.99692     29.593837  3530.400   -897.01358  4457.007
## 2018.4438      657.49730  -1092.905782  2407.900  -2019.51320  3334.508
## 2018.4466     2021.99800    271.594921  3772.401   -655.01250  4699.008
## 2018.4493      367.30287  -1383.100207  2117.706  -2309.70762  3044.313
## 2018.4521     1335.37131   -415.031765  3085.774  -1341.63918  4012.382
## 2018.4548     2705.79622    955.393146  4456.199     28.78573  5382.807
## 2018.4575      997.41210   -752.990975  2747.815  -1679.59839  3674.423
## 2018.4603      172.18512  -1578.217954  1922.588  -2504.82537  2849.196
## 2018.4630     1014.26475   -736.138325  2764.668  -1662.74574  3691.275
## 2018.4658      373.72963  -1376.673444  2124.133  -2303.28086  3050.740
## 2018.4685     1617.78636   -132.616714  3368.189  -1059.22413  4294.797
## 2018.4712     1738.42168    -11.981398  3488.825   -938.58882  4415.432
## 2018.4740     3385.79655   1635.393468  5136.200    708.78605  6062.807
## 2018.4767      828.19043   -922.212645  2578.594  -1848.82006  3505.201
## 2018.4795     1688.35721    -62.045868  3438.760   -988.65329  4365.368
## 2018.4822      943.76395   -806.639130  2694.167  -1733.24655  3620.774
## 2018.4849      915.62063   -834.782448  2666.024  -1761.38987  3592.631
## 2018.4877      267.99628  -1482.406802  2018.399  -2409.01422  2945.007
## 2018.4904     1085.65277   -664.750310  2836.056  -1591.35773  3762.663
## 2018.4932     1446.30963   -304.093451  3196.713  -1230.70087  4123.320
## 2018.4959     1040.83068   -709.572403  2791.234  -1636.17982  3717.841
## 2018.4986      748.65141  -1001.751672  2499.054  -1928.35909  3425.662
## 2018.5014     1407.24331   -343.159767  3157.646  -1269.76718  4084.254
## 2018.5041     1558.75915   -191.643928  3309.162  -1118.25135  4235.770
## 2018.5068     2154.81121    404.408132  3905.214   -522.19929  4831.822
## 2018.5096     2509.99788    759.594804  4260.401   -167.01261  5187.008
## 2018.5123     1557.91324   -192.489837  3308.316  -1119.09725  4234.924
## 2018.5151      840.30295   -910.100131  2590.706  -1836.70755  3517.313
## 2018.5178      811.27642   -939.126662  2561.679  -1865.73408  3488.287
## 2018.5205      986.67890   -763.724183  2737.082  -1690.33160  3663.689
## 2018.5233      554.59508  -1195.808002  2304.998  -2122.41542  3231.606
## 2018.5260     1137.39390   -613.009174  2887.797  -1539.61659  3814.404
## 2018.5288     1435.90108   -314.502001  3186.304  -1241.10942  4112.912
## 2018.5315      660.55676  -1089.846320  2410.960  -2016.45374  3337.567
## 2018.5342     1217.71254   -532.690538  2968.116  -1459.29796  3894.723
## 2018.5370     1402.44424   -347.958837  3152.847  -1274.56626  4079.455
## 2018.5397     1855.42074    105.017660  3605.824   -821.58976  4532.431
## 2018.5425     1210.25253   -540.150550  2960.656  -1466.75797  3887.263
## 2018.5452      917.00111   -833.401966  2667.404  -1760.00938  3594.012
## 2018.5479     1172.55683   -577.846244  2922.960  -1504.45366  3849.567
## 2018.5507     1387.94130   -362.461775  3138.344  -1289.06919  4064.952
## 2018.5534     1197.23406   -553.169014  2947.637  -1479.77643  3874.245
## 2018.5562     1480.75645   -269.646632  3231.160  -1196.25405  4157.767
## 2018.5589     4121.16898   2370.765903  5871.572   1444.15849  6798.179
## 2018.5616     2608.20513    857.802052  4358.608    -68.80537  5285.216
## 2018.5644     1780.94758     30.544506  3531.351   -896.06291  4457.958
## 2018.5671     1324.66882   -425.734255  3075.072  -1352.34167  4001.679
## 2018.5699      732.48299  -1017.920090  2482.886  -1944.52751  3409.493
## 2018.5726     1233.96560   -516.437478  2984.369  -1443.04490  3910.976
## 2018.5753     2105.24961    354.846533  3855.653   -571.76088  4782.260
## 2018.5781      995.95814   -754.444941  2746.361  -1681.05236  3672.969
## 2018.5808      628.67353  -1121.729553  2379.077  -2048.33697  3305.684
## 2018.5836      717.29098  -1033.112096  2467.694  -1959.71951  3394.301
## 2018.5863      726.08343  -1024.319647  2476.487  -1950.92706  3403.094
## 2018.5890      166.33134  -1584.071734  1916.734  -2510.67915  2843.342
## 2018.5918      584.04053  -1166.362552  2334.444  -2092.96997  3261.051
## 2018.5945      858.15689   -892.246188  2608.560  -1818.85361  3535.167
## 2018.5973     1306.25440   -444.148683  3056.657  -1370.75610  3983.265
## 2018.6000     1730.39824    -20.004835  3480.801   -946.61225  4407.409
## 2018.6027      484.02737  -1266.375704  2234.430  -2192.98312  3161.038
## 2018.6055      342.83960  -1407.563483  2093.243  -2334.17090  3019.850
## 2018.6082     2532.50367    782.100592  4282.907   -144.50683  5209.514
## 2018.6110      654.15565  -1096.247426  2404.559  -2022.85484  3331.166
## 2018.6137      700.32576  -1050.077322  2450.729  -1976.68474  3377.336
## 2018.6164     1199.46918   -550.933903  2949.872  -1477.54132  3876.480
## 2018.6192      927.72734   -822.675739  2678.130  -1749.28316  3604.738
## 2018.6219      225.26572  -1525.137361  1975.669  -2451.74478  2902.276
## 2018.6247      701.71379  -1048.689289  2452.117  -1975.29671  3378.724
## 2018.6274      862.88089   -887.522190  2613.284  -1814.12961  3539.891
## 2018.6301      621.49444  -1128.908636  2371.898  -2055.51605  3298.505
## 2018.6329     3070.72641   1320.323336  4821.129    393.71592  5747.737
## 2018.6356      326.18564  -1424.217439  2076.589  -2350.82486  3003.196
## 2018.6384     2697.44959    947.046511  4447.853     20.43909  5374.460
## 2018.6411     4332.79817   2582.395092  6083.201   1655.78767  7009.809
## 2018.6438     2779.95303   1029.549956  4530.356    102.94254  5456.964
## 2018.6466     3194.33534   1443.932258  4944.738    517.32484  5871.346
## 2018.6493      781.88480   -968.518282  2532.288  -1895.12570  3458.895
## 2018.6521     1722.21341    -28.189670  3472.616   -954.79709  4399.224
## 2018.6548      436.67264  -1313.730435  2187.076  -2240.33785  3113.683
## 2018.6575     1284.55446   -465.848616  3034.958  -1392.45603  3961.565
## 2018.6603      647.74242  -1102.660655  2398.146  -2029.26807  3324.753
## 2018.6630     4299.61874   2549.215658  6050.022   1622.60824  6976.629
## 2018.6658     4402.53798   2652.134906  6152.941   1725.52749  7079.548
## 2018.6685     1802.79873     52.395648  3553.202   -874.21177  4479.809
## 2018.6712     1264.02127   -486.381811  3014.424  -1412.98923  3941.032
## 2018.6740     3245.72089   1495.317806  4996.124    568.71039  5922.731
## 2018.6767     1437.30092   -313.102155  3187.704  -1239.70957  4114.311
## 2018.6795     4234.45530   2484.052223  5984.858   1557.44480  6911.466
## 2018.6822     3166.30614   1415.903064  4916.709    489.29565  5843.317
## 2018.6849      463.90829  -1286.494784  2214.311  -2213.10220  3140.919
## 2018.6877     1540.71890   -209.684178  3291.122  -1136.29160  4217.729
## 2018.6904     4801.75430   3051.351224  6552.157   2124.74381  7478.765
## 2018.6932     1511.69184   -238.711236  3262.095  -1165.31865  4188.702
## 2018.6959     2517.61777    767.214691  4268.021   -159.39273  5194.628
## 2018.6986     1391.94544   -358.457643  3142.349  -1285.06506  4068.956
## 2018.7014     1777.42121     27.018128  3527.824   -899.58929  4454.432
## 2018.7041      369.65103  -1380.752052  2120.054  -2307.35947  3046.662
## 2018.7068     4425.75260   2675.349525  6176.156   1748.74211  7102.763
## 2018.7096     4921.81100   3171.407921  6672.214   2244.80050  7598.821
## 2018.7123     3087.27787   1336.874787  4837.681    410.26737  5764.288
## 2018.7151     1493.95548   -256.447603  3244.359  -1183.05502  4170.966
## 2018.7178     2182.57267    432.169595  3932.976   -494.43782  4859.583
## 2018.7205     2130.67917    380.276093  3881.082   -546.33133  4807.690
## 2018.7233     1449.14847   -301.254605  3199.552  -1227.86202  4126.159
## 2018.7260     2290.18026    539.777179  4040.583   -386.83024  4967.191
## 2018.7288     2232.21906    481.815984  3982.622   -444.79143  4909.230
## 2018.7315     2487.55284    737.149760  4237.956   -189.45766  5164.563
## 2018.7342     1745.74632     -4.656760  3496.149   -931.26418  4422.757
## 2018.7370     1432.29427   -318.108807  3182.697  -1244.71623  4109.305
## 2018.7397     1115.25452   -635.148555  2865.658  -1561.75597  3792.265
## 2018.7425      551.81392  -1198.589155  2302.217  -2125.19657  3228.824
## 2018.7452      791.11798   -959.285094  2541.521  -1885.89251  3468.128
## 2018.7479    11088.04186   9337.638782 12838.445   8411.03136 13765.052
## 2018.7507     1136.91236   -613.490721  2887.315  -1540.09814  3813.923
## 2018.7534     3562.69053   1812.287448  5313.094    885.68003  6239.701
## 2018.7562     2209.57700    459.173926  3959.980   -467.43349  4886.588
## 2018.7589      655.30311  -1095.099965  2405.706  -2021.70738  3332.314
## 2018.7616      679.58537  -1070.817708  2429.988  -1997.42513  3356.596
## 2018.7644      409.53488  -1340.868204  2159.938  -2267.47562  3086.545
## 2018.7671     1077.79275   -672.610324  2828.196  -1599.21774  3754.803
## 2018.7699      751.07891   -999.324166  2501.482  -1925.93158  3428.089
## 2018.7726      249.30201  -1501.101066  1999.705  -2427.70848  2926.313
## 2018.7753     1328.53597   -421.867108  3078.939  -1348.47453  4005.546
## 2018.7781     1682.71434    -67.688738  3433.117   -994.29616  4359.725
## 2018.7808     2354.91141    604.508332  4105.314   -322.09909  5031.922
## 2018.7836     1671.37840    -79.024681  3421.781  -1005.63210  4348.389
## 2018.7863      282.31054  -1468.092539  2032.714  -2394.69996  2959.321
## 2018.7890     2168.37913    417.976050  3918.782   -508.63137  4845.390
## 2018.7918      351.12205  -1399.281029  2101.525  -2325.88845  3028.133
## 2018.7945     1041.70095   -708.702128  2792.104  -1635.30955  3718.711
## 2018.7973      896.03644   -854.366641  2646.440  -1780.97406  3573.047
## 2018.8000     4673.81483   2923.411754  6424.218   1996.80434  7350.825
## 2018.8027      132.00146  -1618.401619  1882.405  -2545.00904  2809.012
## 2018.8055      774.30751   -976.095571  2524.711  -1902.70299  3451.318
## 2018.8082      987.54680   -762.856279  2737.950  -1689.46370  3664.557
## 2018.8110      829.44197   -920.961106  2579.845  -1847.56852  3506.452
## 2018.8137      819.26540   -931.137674  2569.668  -1857.74509  3496.276
## 2018.8164      943.70199   -806.701091  2694.105  -1733.30851  3620.712
## 2018.8192     2095.27442    344.871345  3845.678   -581.73607  4772.285
## 2018.8219      702.23214  -1048.170940  2452.635  -1974.77836  3379.243
## 2018.8247     1307.09236   -443.310721  3057.495  -1369.91814  3984.103
## 2018.8274     3524.14608   1773.743000  5274.549    847.13558  6201.157
## 2018.8301     1240.40363   -509.999453  2990.807  -1436.60687  3917.414
## 2018.8329     2831.41926   1081.016185  4581.822    154.40877  5508.430
## 2018.8356     3746.70645   1996.303375  5497.110   1069.69596  6423.717
## 2018.8384     2885.58173   1135.178650  4635.985    208.57123  5562.592
## 2018.8411     2862.09203   1111.688956  4612.495    185.08154  5539.103
## 2018.8438      631.83341  -1118.569670  2382.236  -2045.17709  3308.844
## 2018.8466     2925.93079   1175.527708  4676.334    248.92029  5602.941
## 2018.8493     3466.32819   1715.925107  5216.731    789.31769  6143.339
## 2018.8521     1569.20248   -181.200595  3319.606  -1107.80801  4246.213
## 2018.8548     4603.29727   2852.894191  6353.700   1926.28677  7280.308
## 2018.8575     3107.53849   1357.135415  4857.942    430.52800  5784.549
## 2018.8603     3228.12905   1477.725974  4978.532    551.11856  5905.140
## 2018.8630     2477.14819    726.745110  4227.551   -199.86231  5154.159
## 2018.8658     2403.82176    653.418683  4154.225   -273.18874  5080.832
## 2018.8685     1584.33401   -166.069071  3334.737  -1092.67649  4261.345
## 2018.8712     2516.80082    766.397743  4267.204   -160.20968  5193.811
## 2018.8740     1407.05356   -343.349516  3157.457  -1269.95693  4084.064
## 2018.8767     3835.97865   2085.575574  5586.382   1158.96816  6512.989
## 2018.8795      724.69979  -1025.703288  2475.103  -1952.31071  3401.710
## 2018.8822     2579.44699    829.043914  4329.850    -97.56350  5256.457
## 2018.8849     1626.38520   -124.017880  3376.788  -1050.62530  4303.396
## 2018.8877      507.31782  -1243.085256  2257.721  -2169.69267  3184.328
## 2018.8904     1586.36900   -164.034081  3336.772  -1090.64150  4263.379
## 2018.8932     4580.98162   2830.578542  6331.385   1903.97112  7257.992
## 2018.8959     4859.29321   3108.890133  6609.696   2182.28272  7536.304
## 2018.8986     5176.29128   3425.888200  6926.694   2499.28078  7853.302
## 2018.9014     1753.35151      2.948430  3503.755   -923.65899  4430.362
## 2018.9041     2483.50271    733.099634  4233.906   -193.50778  5160.513
## 2018.9068      808.99578   -941.407299  2559.399  -1868.01472  3486.006
## 2018.9096     1736.28308    -14.120000  3486.686   -940.72742  4413.294
## 2018.9123     6072.13389   4321.730810  7822.537   3395.12339  8749.144
## 2018.9151     3779.35400   2028.950920  5529.757   1102.34350  6456.364
## 2018.9178     3501.19547   1750.792389  5251.599    824.18497  6178.206
## 2018.9205     2092.56825    342.165171  3842.971   -584.44225  4769.579
## 2018.9233     3444.50459   1694.101508  5194.908    767.49409  6121.515
## 2018.9260     3059.13181   1308.728729  4809.535    382.12131  5736.142
## 2018.9288     2636.22131    885.818234  4386.624    -40.78918  5313.232
## 2018.9315     3525.11793   1774.714850  5275.521    848.10743  6202.128
## 2018.9342     1162.00010   -588.402975  2912.403  -1515.01039  3839.011
## 2018.9370     3058.48375   1308.080668  4808.887    381.47325  5735.494
## 2018.9397     4566.43357   2816.030492  6316.837   1889.42307  7243.444
## 2018.9425     1442.93261   -307.470473  3193.336  -1234.07789  4119.943
## 2018.9452     1973.14153    222.738451  3723.545   -703.86897  4650.152
## 2018.9479      762.06306   -988.340023  2512.466  -1914.94744  3439.074
## 2018.9507     3293.55068   1543.147598  5043.954    616.54018  5970.561
## 2018.9534      371.29391  -1379.109172  2121.697  -2305.71659  3048.304
## 2018.9562     7714.77592   5964.372839  9465.179   5037.76542 10391.786
## 2018.9589     4760.29482   3009.891740  6510.698   2083.28432  7437.305
## 2018.9616     2773.02255   1022.619469  4523.426     96.01205  5450.033
## 2018.9644      588.78723  -1161.615848  2339.190  -2088.22327  3265.798
## 2018.9671     1165.52101   -584.882066  2915.924  -1511.48948  3842.532
## 2018.9699      838.27576   -912.127322  2588.679  -1838.73474  3515.286
## 2018.9726     4345.45763   2595.054550  6095.861   1668.44713  7022.468
## 2018.9753     3037.38541   1286.982329  4787.788    360.37491  5714.396
## 2018.9781     7275.11604   5524.712960  9025.519   4598.10554  9952.127
## 2018.9808     1591.95623   -158.446846  3342.359  -1085.05426  4268.967
## 2018.9836     2053.56759    303.164515  3803.971   -623.44290  4730.578
## 2018.9863      950.76572   -799.637354  2701.169  -1726.24477  3627.776
## 2018.9890     1404.13714   -346.265942  3154.540  -1272.87336  4081.148
## 2018.9918     1884.46935 -12743.946051 16512.885 -20487.76139 24256.700

4.4 Evaluation

accuracy(store_forecast$mean, test)
##                ME    RMSE      MAE      MPE     MAPE       ACF1 Theil's U
## Test set 584.6883 2598.47 1687.112 -368.705 431.7623 0.07434906 0.7516374
accuracy(store_hw$fitted, train)
##                ME     RMSE      MAE      MPE     MAPE      ACF1 Theil's U
## Test set 200.5189 2263.837 1302.736 -482.341 532.8632 0.1046868 0.3988737

Although the model may not be overfit, based on the results from accuracy analysis above, this model does not predict well and has poor accuracy in both the train data and test data.

4.5 Predicting

pred7days <- forecast(store_hw, h = 365+7)
pred7days$mean %>% tail(7)
## Time Series:
## Start = c(2018, 364) 
## End = c(2019, 5) 
## Frequency = 365 
## [1] 2019.0528 1167.5672  839.1805 1254.3939  695.6954  152.8959  143.5868

Above is the predicted sales amount for the next 7 days after our given data.