0
$\begingroup$

We use the TBATS model for the multiple seasonal data that we have. The data has a weekday season and an hour season, that is, Monday 7 PM is different from Sunday 1 AM.

The data values are as follows:

11829.93056
12115.39361
13019.32222
17269.24194
12505.68
11262.57333
9606.739444
11203.85194
12877.34
14470.51
15870.81972
16390.11083
17376.05806
16102.22444
16661.82778
16460.21111
20298.25444
15944.43028
14685.41889
14632.28944
14696.605
21892.19972
23234.61333
14039.54472
12563.34917
12538.60306
14233.89194
12486.57889
12054.56583
11705.69
14726.88444
13017.40167
13879.06194
15593.45444
17336.06806
21501.78778
19974.05972
19073.66639
21844.75944
17629.15333
17497.83139
15995.27417
14888.28417
14471.65139
15312.29583
15394.80111
15960.46111
15349.43556
15815.4325
15538.84611
11859.71083
11522.90139
10585.93167
11449.89528
11112.48111
10759.425
14024.88444
16650.89361
17248.18111
18384.01806
17187.28028
18262.22556
17730.12833
16985.44028
17010.89806
15588.83056
13671.79611
14274.7975
13425.27972
14448.28972
14521.03556
14800.30833
14000.06722
13607.45111
12715.93444
12339.62611
11844.62833
10501.85028
19723.68611
20267.69861
22456.30389
23511.98806
24455.92
25145.62556
26020.66944
17916.12889
24517.97778
23770.22667
19571.07417
17996.83778
17271.06806
17830.30722
18720.73972
19122.61639
15571.465
12922.33417
13723.09639
17647.35333
11572.57667
11357.44417
14547.54722
14125.18
14994.63028
18160.55833
18887.15056
15324.03333
13512.97361
13095.61889
13885.85167
13394.13667
12920.86778
12923.62944
11788.72722
11240.96722
11032.16083
10445.64333
11035.82389
11560.62556
11504.13778
10497.4475
10737.13167
10150.14667
10762.57389
9903.854444
10140.26
9688.386667
10509.27917
10248.26417
9415.921667
10317.93111
10698.62694
10985.4325
11201.22806
10079.32222
19137.15222
19922.79528
20105.84889
19941.86222
20034.24944
19221.77333
19294.19583
19107.62194
18881.74056
18907.41778
10831.27278
9277.010556
9314.684722
9259.294722
9554.547222
14420.98139
14924.89694
14974.48556
15503.59167
16659.26972
12662.52417
9626.746667
9865.950833
10459.35167
18345.29528
18862.61667
18675.25806
18405.705
18731.62917
19177.36694
18392.0975
17935.47917
17484.53972
17719.87306
19107.24417
18246.28722
24187.27361
20980.10694
19525.48667
19431.23167
16002.71194
16641.28944
13358.51
15243.24972
15344.55056
14853.2875
14074.7125
13583.175
13156.07139
12824.65556
12757.16667
10528.55083
9947.246389
9630.976944
10244.15639
9409.265833
11116.56278
10366.12639
10153.84167
11284.9225
11159.70111
9844.233889
10202.50167
9568.284444
9453.295
10087.96667
12115.45028
13848.12306
14085.58556
14119.16639
13463.62083
12659.21861
12490.11583
12472.53083
12066.99583
10782.94806
10370.11389
9514.4325
10128.31111
10287.96417
16267.74583
12235.29
10766.09306
9632.443333
9911.907778
10926.47139
10149.79806
9872.881667
10550.87556
10099.79389
10955.50583
12502.37667
14016.16583
13759.69111
13354.76083
13441.13278
13614.22306
12074.39694
10953.05889
9608.564167
9369.955833
9126.791667
9467.274167
9238.055
9772.7275
9634.910556
10008.76889
9154.832778
9972.528333
8797.026389
8061.764167
9283.602778
9082.788611
10392.84333
12594.84472
13857.24444
14509.44556
13282.09667
14081.56167
13780.65194
13510.57389
13954.83361
12080.78361
10886.06528
10170.02444
9353.154722
9504.954167
9619.754444
9584.189722
9539.824722
9512.598889
9751.026111
10007.43972
14872.5625
10462.59028
10238.43806
10855.00972
11907.83306
13041.46056
12769.60222
13513.02389
13168.42444
12410.44528
11972.17889
12051.24
11734.57667
11829.43833
10193.46972
9139.389722
8799.294444
9572.772222
9653.447222
9395.038333
9366.819722
9312.179167
8934.111667
9061.167778
9177.980833
9629.165278
8917.401111
9391.761389
9488.683056
10222.37056
9936.818056
10589.30222
10754.32056
11253.62417
9981.786111
10241.75861
9886.606389
9408.076389
9010.417778
8554.566944
8853.988889
8812.548333
9363.989167
8686.458611
6375.811944
8841.628056
9031.061667
9032.021111
9693.056111
9192.849444
12158.49556
19376.95722
13869.38
10368.60056
10969.33639
13612.96972
13405.11972
11089.95
10890.48528
11615.31194
11165.01333
11869.86667
10645.96917
11575.75528
11569.00333
10819.37917
11056.02167
9912.643611
8935.328056

We fit a TBATS model on this data as follows:

x <- read.csv("data.csv")
xx <- msts(x, seasonal.periods=c(24,168))
model <- tbats(xx)
f <- forecast(model,h=24,level=90)

The resulting forecast values are:

        Point Forecast    Lo 90    Hi 90
5.000000       8979.853 6742.414 11959.78
5.005952       9038.017 6040.018 13524.09
5.011905       9087.293 5580.098 14798.83
5.017857       9129.000 5235.257 15918.73
5.023810       9164.273 4958.588 16937.06
5.029762       9194.083 4727.093 17882.27
5.035714       9219.264 4527.715 18772.12
5.041667       9240.524 4352.326 19618.77
5.047619       9258.466 4195.534 20431.06
5.053571       9273.604 4053.589 21215.70
5.059524       9286.371 3923.786 21977.93
5.065476       9297.137 3804.110 22721.94
5.071429       9306.213 3693.026 23451.12
5.077381       9313.864 3589.336 24168.27
5.083333       9320.311 3492.091 24875.70
5.089286       9325.745 3400.522 25575.35
5.095238       9330.324 3314.000 26268.84
5.101190       9334.181 3232.002 26957.57
5.107143       9337.431 3154.091 27642.71
5.113095       9340.169 3079.892 28325.27
5.119048       9342.475 3009.085 29006.10
5.125000       9344.418 2941.395 29685.97
5.130952       9346.055 2876.578 30365.51
5.136905       9347.433 2814.422 31045.28

These forecasts values look VERY smoothed out which makes the predictions inaccurate:

enter image description here

Why is it smoothing out like that? We tried setting box.cox to FALSE but that did not work. Any ideas?

$\endgroup$
  • $\begingroup$ Unless my cut-and-paste of your data failed, if you look at the autocorrelation and partial autocorrelation functions of your data, there appears to be no 24-period effect. Similarly with a 168-period effect, but with only 204 observations, you would have some difficulty estimating a 168-period effect in any case. So... you are left with a damped trend, it appears. $\endgroup$ – jbowman Jul 7 '17 at 15:33
  • $\begingroup$ @jbowman Actually the copy-and-paste failed on my end. I was supposed to paste 336 data values (24*7*2), but pasted only 204. Data is updated now and you should be able to see the problem I am talking about. Sorry for the initial error in data. $\endgroup$ – learnerX Jul 7 '17 at 17:38
  • $\begingroup$ Thanks. It does appear, for whatever reason, that TBATS is ignoring those seasonal components, no matter how I set it up, leaving you with the damped trend. Not sure what to make of that; it could be that they don't improve the AIC. I'll poke around a little more. $\endgroup$ – jbowman Jul 7 '17 at 18:25
  • $\begingroup$ It used to work fine for this kind of dataset when we set use.box.cox = FALSE, but lately even that doesn't prevent the disruptive smoothing of forecast data. Maybe Rob Hyndman changed something recently in the TBATS function in his forecast package? Thanks for looking into it though, appreciate it. $\endgroup$ – learnerX Jul 7 '17 at 18:42
  • $\begingroup$ @jbowman Could it be that the date and time stamps associated with this data are improper and so it is not being treated as a "time-series" by TBATS? $\endgroup$ – learnerX Jul 7 '17 at 19:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.