I am working with a time series made of daily observations which shows a 7-days period with a drop on Sundays (and holidays, more in general) and I the set period to 7 days.
While exploring my data via pm.utils.decomposed_plot, I found out that residual component of the decomposed time series still shows a (not catched) seasonal pattern. Playing a bit with the period, it turned out the periods in the form of m=14*k with k=1, 2, ... actually return "expected" residuals shape.
In the below example, residuals computed with pm.arima.decompose and period=7 have a norm2 which is ~6x the one obtained with period=14. In contrast both residuals computed (as benchmark) via statsmodels.tsa.seasonal result similar to each other.
With such a time series I expected that residuals computed with both 7 and 14 days periods are similar to each other, as the ones returned by statsmodels.tsa.seasonal.
Actual Behavior
In the attached sample, residuals computed with pm.arima.decompose and period=7 still show an uncatched pattern and their norm2 is ~6x the one obtained with period=14. In contrast both residuals computed (as benchmark) via statsmodels.tsa.seasonal result similar to each other.
Additional Context
First of all, thanks for such an amazing library!
I am working with a time series made of daily observations which shows a 7-days period with a drop on Sundays (and holidays, more in general).
While exploring my data via pm.utils.decomposed_plot, I found out that residual component of the decomposed time series still shows a (not catched) seasonal pattern. Playing a bit with the period, it turned out the periods in the form of m=14*k with k=1, 2, ... actually return "expected" residuals shape.
Since the supposed problem disappears by doubling the natural period, which is an odd number, i.e. making it even, I inspected pm.arima.decompose source code identifying the cause at line 136 which make this swap:
In contrast, I wasn't able to locate anything similar into statsmodels.tsa.seasonal source code, and residuals computed with period=7 and period=14 by statsmodels seem to be indeed coherent with each other (see the above snippet for reproducibility).
Describe the bug
I am working with a time series made of daily observations which shows a 7-days period with a drop on Sundays (and holidays, more in general) and I the set period to 7 days.
While exploring my data via
pm.utils.decomposed_plot
, I found out that residual component of the decomposed time series still shows a (not catched) seasonal pattern. Playing a bit with the period, it turned out the periods in the form ofm=14*k
with k=1, 2, ... actually return "expected" residuals shape.In the below example, residuals computed with
pm.arima.decompose
and period=7 have a norm2 which is ~6x the one obtained with period=14. In contrast both residuals computed (as benchmark) viastatsmodels.tsa.seasonal
result similar to each other.To Reproduce
Output
Period: 7 days
Period: 14 days
Norm2 of computed residuals statsmodels_7 : 40.51 pmdarima_7 : 235.11 statsmodels_14: 41.13 pmdarima_14 : 41.16
Versions
Expected Behavior
With such a time series I expected that residuals computed with both 7 and 14 days periods are similar to each other, as the ones returned by
statsmodels.tsa.seasonal
.Actual Behavior
In the attached sample, residuals computed with
pm.arima.decompose
and period=7 still show an uncatched pattern and their norm2 is ~6x the one obtained with period=14. In contrast both residuals computed (as benchmark) viastatsmodels.tsa.seasonal
result similar to each other.Additional Context
First of all, thanks for such an amazing library!
I am working with a time series made of daily observations which shows a 7-days period with a drop on Sundays (and holidays, more in general).
Following tips in the docs about setting period parameter as well as the blog post by Rob J Hyndman, I set
m=7
.While exploring my data via
pm.utils.decomposed_plot
, I found out that residual component of the decomposed time series still shows a (not catched) seasonal pattern. Playing a bit with the period, it turned out the periods in the form ofm=14*k
with k=1, 2, ... actually return "expected" residuals shape.Since the supposed problem disappears by doubling the natural period, which is an odd number, i.e. making it even, I inspected
pm.arima.decompose
source code identifying the cause at line 136 which make this swap:In contrast, I wasn't able to locate anything similar into
statsmodels.tsa.seasonal
source code, and residuals computed with period=7 and period=14 bystatsmodels
seem to be indeed coherent with each other (see the above snippet for reproducibility).Is this a bug? Am I missing something?