# Time series forecasting and decomposition

I have a project about time series analysis. My data are not stationary and they have daily seasonality as shown in figure below. Is it correct to do the following steps?

• Decompose Time serie into season, trend , residuals
• Model residuals using ARIMA
• Then add back seasonality and trend

Should i model seasonality and trends too?

        Count

12
18
7
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
11
25
39
63
163
190
219
289
416
600
679
705
770
807
720
544
603
592
419
333
336
424
290
369
273
342
269
297
274
331
291
357
185
301
287
399
342
338
293
452
331
545
390
355
362
385
443
449
400
594
405
551
355
407
324
391
206
307
201
223
213
209
194
163
166
156
119
126
91
71
9
37
45
23
33
9
27
3
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
14
18
45
60
138
157
190
272
395
556
516
553
811
702
630
507
480
425
349
309
310
379
282
248
256
248
226
222
205
242
214
220
236
166
276
337
239
309
371
290
397
299
343
377
358
436
386
346
467
571
424
398
304
346
323
225
264
258
171
168
109
200
130
94
93
94
139
87
56
37
77
25
42
26
32
16
25
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
15
10
40
61
126
172
208
254
345
568
567
634
616
808
728
398
455
440
350
320
289
386
259
290
249
344
226
296
235
279
219
284
171
240
225
350
316
335
311
301
350
356
390
308
366
443
285
396
416
468
466
401
292
334
454
309
296
294
214
235
167
248
144
141
124
110
222
108
88
87
31
31
38
40
41

• What is the seasonality for the Data above ? It it 7 ? Jul 21 '18 at 14:11
• The time serie contains 3 days of data every 15 minutes. So i think saesonality is 96. Jul 21 '18 at 14:56
• I will try and help you .. Please post the data in a csv file. As an overview comment ...pure SARIMA implies that the model structure is all endogenous whereas if there are hourly effects deterministic structure may be needed. Only uour data knows for sure ..so lets listen to it. Jul 21 '18 at 15:01
• So you think making the time series stationary using decomposition is wrong? Jul 21 '18 at 15:27
• I didn't say that .... Jul 21 '18 at 16:04

The strong relationship is not within day but across days . You have 3 samples i.e. 3 days . For example your first reading per day is more related to the first reading on the previous day than the last reading of the previous day ( ala an ar(1) ). Memory or predictability is across similar time periods for previous days. Those who suggest arima/sarima have swallowed the pill/poison ! As a recovering arima addict , I fully understand the symptoms.

In my opinion ( after looking at your data with AUTOBOX ) you are probably wasting you time trying to use arima or sarima .. I suggest that you extend your data from 3 to many more days ..and then employ developing daily forecasts and using daily totals and predictions as a driver to predict each of the 96 slices ... then roll the forecasts up and reconcile them with the daily forecasts. We have successfully done this for half-hour call center forecasting data here http://demand-planning.com/2010/03/18/can-forecasting-help-me-staff-a-specific-hewlett-packard-call-center-at-1030-am-on-a-friday/ and are currently looking at using 15 minute time slices (96 per day ) for Taco Bell.

• Thanks for wasting your time to help me. I will have access to more data soon but they will be unfortunately max 20 days. The main goal of the project was to compare linear models like ARIMA with Neural networks in time series forecasting. Jul 21 '18 at 20:35
• Why would you say "wasting my time" when you can just upvote my answer to show your true appreciation for my valuable time. 20 days would do just fine .... Jul 21 '18 at 20:39

For me, this seems a good approach but you can do better by comparing the results you obtain (e.g. h-step ahead forecasting error) using this approach with the results you obtain with a seasonal ARIMA (or SARIMA) model in order to decide which one is "the best".

• Sarima works with non-stationary data? One problem with sarima is that period is too high (96) and my program crashes. Jul 21 '18 at 14:58
• SARIMA includes a classical differencing (the "I" of SARIMA) and a seasonal one (the "S" of SARIMA).
– paf
Jul 21 '18 at 15:35
• I uploaded my data above so which value D for sarima should take? Jul 21 '18 at 15:51
• In general, D should be 0 or 1 (so probably 1 is a good choice in your case). But auto.arima function in R chooses D automatically.
– paf
Jul 21 '18 at 17:36
• I am working in python but i will give it a try and compare the results as you said. Do you have any paper for decomposotion and forecasting to use it as reference? Thanks for everything. Jul 21 '18 at 18:02