Removes seasonal components from a time series. It uses autocorrelation to identify the periods of dominant seasonal components, then subtracts the seasonal average from each point to yield a series of the seasonal residuals. Because of the autocorrelation step it is recommended that the series be de-trended first using "/TimeSeries/LinearDetrend" as a linear trend may result in undesirable autocorrelation artifacts. For instance, it has been observed in test cases that removing seasonality from series with a noticeable linear trend and non-zero mean yields a series in which almost all entries are zero, except for points at the beginning and end.

There are two options, "givenPeriod" and "topNPeriods". Calling [[series],k,"givenPeriod"] subtracts from each point it's period length k seasonal average, removing a seasonal trend with period k. [[series],k,"topNPeriods"] removes the top k strongest seasonal trends as identified by autocorrelation. Calling the algorithm with just the series means the default option, e.g. removing only the strongest seasonal pattern, will be used.

Note that removing a period of length 1 is a linear detrending that subtracts out the mean value, resulting in a series with slope and mean 0. When removing the top N trends, we ignore periods of length 1, as doing so can cause unwanted artifacts.