This book is in Open Review. I want your feedback to make the book better for you and other readers. To add your annotation, select some text and then click the on the pop-up menu. To see the annotations of others, click the button in the upper right hand corner of the page

11.5 Dealing with categorical variables in ETSX

When dealing with categorical variables in regression context, they are typically expanded to a set of dummy variables. So, for example, having a variable promotions that can be "light", "medium" and "heavy" for different observations \(t\), we would expand it to three dummy variables, promolight, promomedium and promoheavy, each one of which is equal to 1, when the respective promotion type is used and equal to zero otherwise. When including these variables in the model, we would drop one of them (which is sometimes called pivot variable) and have a model with two dummy variables of a type: \[\begin{equation} y_t = a_0 + a_1 x_{1,t} + \dots + a_n x_{n,t} + d_1 promolight_t + d_2 promomedium_t + \epsilon_t, \tag{11.25} \end{equation}\] where \(d_i\) is the parameter for the \(i\)-th dummy variable. The same procedure can be done in the context of ETSX, and the principles will be exactly the same for ETSX{S}. However, when it comes to the dynamic model, the parameters have time indeces, and there can be different ways of formulating the model. Here is the first one: \[\begin{equation} \begin{aligned} y_{t} = & a_{0,t-1} + a_{1,t-1} x_{1,t} + \dots + a_{n,t-1} x_{n,t} + d_1 promolight_t + d_2 promomedium_t + \epsilon_t \\ a_{i,t} = & a_{i,t-1} + \left \lbrace \begin{aligned} &\delta_i \frac{\log(1+\epsilon_t)}{x_{i,t}} \text{ for each } i \in \{1, \dots, n\}, \text{ if } x_{i,t}\neq 0 \\ &0 \text{ otherwise } \end{aligned} \right. \\ d_{1,t} = & d_{1,t-1} + \left \lbrace \begin{aligned} &\delta_{n+1} \epsilon_t, \text{ if } promolight_t\neq 0 \\ &0 \text{ otherwise } \end{aligned} \right. \\ d_{2,t} = & d_{2,t-1} + \left \lbrace \begin{aligned} &\delta_{n+2} \epsilon_t, \text{ if } promomedium_t\neq 0 \\ &0 \text{ otherwise } \end{aligned} \right. \end{aligned} . \tag{11.26} \end{equation}\] Here we assume that each specific category of the variable promotion changes over time on its own with their own smoothing parameters \(\delta_{n+1}\) and \(\delta_{n+1}\). Alternatively, we can assume that they have the same smoothing parameters, implying that the changes of the parameters are similar throughout different categories of the variable: \[\begin{equation} \begin{aligned} d_{1,t} = & d_{1,t-1} + \left \lbrace \begin{aligned} &\delta_{n+1} \epsilon_t, \text{ if } promolight_t\neq 0 \\ &0 \text{ otherwise } \end{aligned} \right. \\ d_{2,t} = & d_{2,t-1} + \left \lbrace \begin{aligned} &\delta_{n+1} \epsilon_t, \text{ if } promomedium_t\neq 0 \\ &0 \text{ otherwise } \end{aligned} \right. \end{aligned} . \tag{11.27} \end{equation}\] This case becomes useful in makeing the connection between the ETSX and the conventional seasonal ETS model. Let's assume that we deal with quarterly data with no trend and we have a categorical variable quarterOfYear, which can be First, Second, Third and Fourth, depending on the specific observation. For convenience, I will call the parameters for the dummy variables, created from this categorical variable \(s_{1,t}, s_{2,t}, s_{3,t} \text{ and } s_{4,t}\). Based on (11.27), the model can then be formulated as: \[\begin{equation} \begin{aligned} y_{t} = & l_{t-1} + s_{1,t} quarterOfYear_{1,t} + s_{2,t} quarterOfYear_{2,t} \\ & + s_{3,t} quarterOfYear_{3,t} + s_{4,t} quarterOfYear_{4,t} + \epsilon_t \\ l_t = & l_{t-1} + \alpha \epsilon_t \\ s_{i,t} = & s_{i,t-1} + \left \lbrace \begin{aligned} &\delta \epsilon_t \text{ for each } i \in \{1, \dots, 4\}, \text{ if } quarterOfYear_{i,t}\neq 0 \\ &0 \text{ otherwise } \end{aligned} \right. \end{aligned} . \tag{11.28} \end{equation}\] We intentionally added all 4 dummy variables here, so that they separate seasonal effect from the level component. While in the regression and ETSX{S} contexts, this does not make much sense, in the ETSX{D} we avoid the trap of dummy variables due to the dynamic update of parameters. Having done that, we have just formulated the conventional ETS(A,N,A) model using a set of dummy variables, the difference being that the latter relies on the lag of component: \[\begin{equation} \begin{aligned} y_{t} = & l_{t-1} + s_{t-4} \epsilon_t \\ l_t = & l_{t-1} + \alpha \epsilon_t \\ s_t = & s_{t-4} + \gamma \epsilon_t \\ \end{aligned} . \tag{11.29} \end{equation}\]

So, this comparison shows on one hand that the mechanism of ETSX{D} is natural for the ETS model, and on the other hand that using the same smoothing parameters for categorical variables can be a reasonable idea, especially in cases, when we do not have grounds to assume that each category of variable should evolve over time independently.