Old school D3 from simpler times

If you suspect a time serie has a seasonality component, this is an example of how to validate/invalidate this hypothesis.

Seasonality means that the time serie has a periodic component, repeating the same pattern on each period. For example, sales of a store may have a week-based seasonality: sales increase on saturday, while there is no sale at all on sunday.

Graphically speaking, detecting a seasonality is (quite) easy: just look for a repeating pattern. Note that it could be difficult if the pattern has a long period, or/and the order of magnitude of the seasonilaty is low (ie. lowest and highest values are not so far from the season's mean, but in this case there might be no seasonality at all ! ).

Computationnaly speaking, one can use the **autocorrelation** technique. Correlation is a technique that allows to determine if 2 time series are correlated (ie. if they behave in the same way). Autocorrelation is the same technique applied to only 1 time serie: it allows to compare the correlation between a time serie and the same time serie shifted by a certain amount of time. Hence, if you suspect a seasonality of 7 days, then the autocorrelation between the time serie and the same time serie shifted by 7 days will validate (autocorrelation near 1) or invalidate (autocorrelation near 0) the seasonality.

- in the left graph, Drag & Drop points to update the timeline and create seasons of your choice (below the graph are some shortcuts)
- then test for a particular seasonality period, and see how the coefficient of correlation behaves;
- decrease the order of magnitude of the season component to see that when this order is small, then it becomes difficult to detect a season; this is because the coefficient of correlation is constantly high; even for the test of a suspected season's length that is not the real one.

- another block explains time series correlation
- another block deals with the impact of seasonality when computing the trend of a timeline

- done with D3 v3.5.5
- blockbuilder.org

forked from Kcnarf's block: timeline - seasonality detection (I)

https://d3js.org/d3.v3.min.js