0
$\begingroup$

Suppose I have a timeseries, something like this:

# A tsibble: 96 x 2 [1M]
   timestamp targetValue
       <mth>       <dbl>
 1  2011 Jan    8807887.
 2  2011 Feb    8047481.
 3  2011 Mar    4206680.
 4  2011 Apr   12805026.
 5  2011 May    8487980.
 6  2011 Jun    8288872.
 7  2011 Jul    8950038.
 8  2011 Aug    8246225.
 9  2011 Sep    9045951.
10  2011 Oct    8133714.
11  2011 Nov    8615649.
12  2011 Dec    8949665.
13  2012 Jan    7400942.
14  2012 Feb    7774995.
15  2012 Mar    3521120.
16  2012 Apr   12196836.
17  2012 May    7475631.
18  2012 Jun    6378579.
19  2012 Jul    6327822.
20  2012 Aug    7679169.
21  2012 Sep    6852647.
22  2012 Oct    6104852.
23  2012 Nov    6603811.
24  2012 Dec    7103982.
25  2013 Jan    7318718.
26  2013 Feb    6327166.
27  2013 Mar   10583778.
28  2013 Apr    1486028.
29  2013 May    6609755.
30  2013 Jun    6123774.
31  2013 Jul    6525356.
32  2013 Aug    6634035.
33  2013 Sep    6775410.
34  2013 Oct    6139110.
35  2013 Nov    6617715.
36  2013 Dec    5758138.
37  2014 Jan    6173796.
38  2014 Feb    6193086.
39  2014 Mar    1369283.
40  2014 Apr   10862225.
41  2014 May    6719338.
42  2014 Jun    6523341.
43  2014 Jul    7009035.
44  2014 Aug    6429927.
45  2014 Sep    6191727.
46  2014 Oct    6929547.
47  2014 Nov    6436277.
48  2014 Dec    7344969.
49  2015 Jan    6583656.
50  2015 Feb    7025900.
51  2015 Mar   11131747.
52  2015 Apr    2234209.
53  2015 May    7451495.
54  2015 Jun    7112371.
55  2015 Jul    6926740.
56  2015 Aug    7024481.
57  2015 Sep    7209520.
58  2015 Oct    6978664.
59  2015 Nov    5739805.
60  2015 Dec    7053777.
61  2016 Jan    6778982.
62  2016 Feb    6986373.
63  2016 Mar   11368732.
64  2016 Apr    3234200.
65  2016 May    6623093.
66  2016 Jun    7470512.
67  2016 Jul    7106562.
68  2016 Aug    7442240.
69  2016 Sep    7446251.
70  2016 Oct    7408437.
71  2016 Nov    6738305.
72  2016 Dec    7138813.
73  2017 Jan    7442611.
74  2017 Feb    6775783.
75  2017 Mar    2674532.
76  2017 Apr   11571766.
77  2017 May    7376416.
78  2017 Jun    7229772.
79  2017 Jul    6660626.
80  2017 Aug    6572461.
81  2017 Sep    7626926.
82  2017 Oct    7130972.
83  2017 Nov    7073761.
84  2017 Dec    6985022.
85  2018 Jan    6546966.
86  2018 Feb    7252383.
87  2018 Mar   11130375.
88  2018 Apr    2635667.
89  2018 May    7292191.
90  2018 Jun    7218206.
91  2018 Jul    7419891.
92  2018 Aug    6652166.
93  2018 Sep    7095116.
94  2018 Oct    7386819.
95  2018 Nov    6367653.
96  2018 Dec    6474530.

timeseries

I use STL additive decomposition to decompose the timeseries in seasonality, trend and remainder (the seasonality is not interesting for my analysis, so I use only the seasonally adjusted timeseries)

stl_dcmp = target_ts %>% STL(targetValue ~ season(window = 'periodic') + trend(window = 13), robust = TRUE)

timeseries decomposition

The goal is to “catch” (explain with an exogenous variable) the non seasonal signal, that is the anomaly in the remainder.

I have a dummy variable predictor, like this:

    # A tsibble: 96 x 2 [1M]
   timestamp predValue
       <mth>     <dbl>
 1  2011 Jan         0
 2  2011 Feb         0
 3  2011 Mar        -1
 4  2011 Apr         1
 5  2011 May         0
 6  2011 Jun         0
 7  2011 Jul         0
 8  2011 Aug         0
 9  2011 Sep         0
10  2011 Oct         0
11  2011 Nov         0
12  2011 Dec         0
13  2012 Jan         0
14  2012 Feb         0
15  2012 Mar        -1
16  2012 Apr         1
17  2012 May         0
18  2012 Jun         0
19  2012 Jul         0
20  2012 Aug         0
21  2012 Sep         0
22  2012 Oct         0
23  2012 Nov         0
24  2012 Dec         0
25  2013 Jan         0
26  2013 Feb         0
27  2013 Mar         1
28  2013 Apr        -1
29  2013 May         0
30  2013 Jun         0
31  2013 Jul         0
32  2013 Aug         0
33  2013 Sep         0
34  2013 Oct         0
35  2013 Nov         0
36  2013 Dec         0
37  2014 Jan         0
38  2014 Feb         0
39  2014 Mar        -1
40  2014 Apr         1
41  2014 May         0
42  2014 Jun         0
43  2014 Jul         0
44  2014 Aug         0
45  2014 Sep         0
46  2014 Oct         0
47  2014 Nov         0
48  2014 Dec         0
49  2015 Jan         0
50  2015 Feb         0
51  2015 Mar         1
52  2015 Apr        -1
53  2015 May         0
54  2015 Jun         0
55  2015 Jul         0
56  2015 Aug         0
57  2015 Sep         0
58  2015 Oct         0
59  2015 Nov         0
60  2015 Dec         0
61  2016 Jan         0
62  2016 Feb         0
63  2016 Mar         1
64  2016 Apr        -1
65  2016 May         0
66  2016 Jun         0
67  2016 Jul         0
68  2016 Aug         0
69  2016 Sep         0
70  2016 Oct         0
71  2016 Nov         0
72  2016 Dec         0
73  2017 Jan         0
74  2017 Feb         0
75  2017 Mar        -1
76  2017 Apr         1
77  2017 May         0
78  2017 Jun         0
79  2017 Jul         0
80  2017 Aug         0
81  2017 Sep         0
82  2017 Oct         0
83  2017 Nov         0
84  2017 Dec         0
85  2018 Jan         0
86  2018 Feb         0
87  2018 Mar         1
88  2018 Apr        -1
89  2018 May         0
90  2018 Jun         0
91  2018 Jul         0
92  2018 Aug         0
93  2018 Sep         0
94  2018 Oct         0
95  2018 Nov         0
96  2018 Dec         0

dummy variable predictor

I want to test if this predictor is good for catching that signal, so I thought of isolating the remainder (anomaly signal + white noise) and perform the analysis only on that component, for example comparing results (i.e. predictive accuracy, forecast error reduction, prediction intervals, residuals autocorrelation, etc...) of two ARIMA models fitted to the remainder, one with the dummy variable predictor as exogenous regressor (ARIMA errors) and the other one without it.

Does this kind of analysis make sense?

$\endgroup$

1 Answer 1

0
$\begingroup$

As a general rule you don't want to do piece-fitting using previous results to feed the next stage without a simultaneous optimization.

In this case after identifying the regime shift (visually obvious) , we treat the most recent set of values reflecting homogeneous structure.

I took your very interesting ( to me ! ) time series enter image description here which visually appeared to to represent two different regimes.

Using the Chow test for constancy of parameters , AUTOBOX .. a commercial poece of software that I have helped to develop ... concluded that a regime shift in parameters occurred on or about period 55

 withenter image description here this based upon this model enter image description here and enter image description here

After refining the model with some needed pulse indicators we obtainedenter image description here and enter image description here

The Actuaenter image description herel/Fit and Forecast graph is here enter image description here with forecasts here

Finally the statistienter image description herecs for the final model are here

with residual plot here enter image description here

We have identified the anomalies in the remainder enter image description here

$\endgroup$

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.