A Complete Introduction To Time Series Analysis (with R):: Classical Decomposition Model part II

Hair Parra
Analytics Vidhya
Published in
5 min readJun 13, 2020

--

The antidiabetic drug sales data shows a clear pattern: by the end of every year, antidiabetic drug sales spike. Perhaps those Christmas candies and cookies are to blame!

In the last article, we introduced the classical decomposition model, and had a comprehensive discussion of trend estimation, notably using the moving average filter. This time, we will discuss the final missing part: seasonality.

Estimating Seasonality

Assume that Yt is some White Noise process, and consider the classical decomposition model

The equations above are just mathematical formalizations of the notion that the process “kind of behaves similarly” every certain period or season. For instance, you can expect winter to start roughly at the same time every year (even in Canada, where we have winter 8 months a year). How can we estimate this seasonal component? Suppose we have some series

Suppose also, that these data have some seasonal function with a period d. We let k=1,..,d be an index ranging over each season. In order to estimate the seasonal component, we follow the next procedure:

The following table might be helpful for visualization for 12 observations and four seasons:

--

--

Hair Parra
Analytics Vidhya

Data Scientist & Data Engineer. CS, Stats & Linguistics graduate. Polyglot.