This blog piece intends to introduce a new addin (i.e. LOCALLINEAR) that estimates local linear trends via Kalman filter.
Table of Contents
Introduction
Filtering trend component is a useful way of summarizing time series data as it allows one to capture and focus on the important characteristics that truly matter. However, filtering methods may lead to loss of information and therefore come at a price. Nevertheless, Linear State Space Models (LSSM) offer a practical approach to extract the unobserved trend component of an observed variable.Local Linear Trend Model
Addin implements the following framework:\begin{align*} y_{t} &= \mu_{t} + \sum_{i = 1}^{m}{b_{i} x_{it}} + e_{t}, \quad e_t \sim IID(0, \sigma_{e}^{2})\\ \mu_{t} &= \mu_{t  1} + \Delta\mu_{t  1} + \epsilon_{t}, \quad \epsilon_t \sim IID(0, \sigma_{\epsilon}^{2})\\ \Delta\mu_{t} &= \Delta\mu_{t  1} + v_{t}, \quad v_t \sim IID(0, \sigma_{v}^{2}) \end{align*} The model above is very flexible, which can make it difficult to differentiate unobserved trend values from the actual levels in practice. In such cases, restricting the variance of trend equation to zero (i.e. $ \sigma_{\epsilon}^{2} = 0 $) may help obtain a smooth(er) stochastic trend. It is also possible to impose an exogenous penalty parameter (i.e. $ \lambda = \frac{1}{q} $) at the outset and control the smoothness of trend (i.e. $ \sigma_{v}^{2} = \frac{\sigma_{e}^{2}}{\lambda} $) as in the sense of HodrickPrescott filter.
Any kind of explanatory variable(s) or intervention effect(s) can be added to the model through regressors in the signal equation.
Application to weekly credit card expenditure data
High(er) frequency financial variables are generally noisy due to a number of reasons, most of which cannot be controlled or identified even after the fact. Filtering out the noise component arising naturally from changing market conditions periodtoperiod may provide us with a clear(er) picture of underlying trend without much loss of critical information. In this exercise, Turkish weekly credit card expenditure data is used (see Figure 1).




To estimate local linear trend model, we can use the addin (see Figure 3).




Files
References
 Durbin, J. and Koopman, S. J. (2001), Time Series Analysis by State Space Methods, 2nd ed.", Oxford University Press.
No comments:
Post a Comment