## Trend extraction and Detrending

Filters may be applied to a time series for a variety of reasons. Suppose that a time series consists of a long-term movement, a trend, upon which is superimposed an irregular component. A moving average filter will smooth the series revealing the trend more clearly.

Assume that $m_{t}$ is the filtered version of the $y_{t}$ series. Then

$m_{t} = M_{n}(L)y_{t} =\sum_{j=-r}^{j=r} w_{j}y_{t-j}$

The weights of a moving average filters add up to one i.e.  $M_{n}(L)=1$. The simplest such filter is the uniform moving average for which:

$w_{j} = \frac{1}{n} \; \; \; \; j=-r,...,r$

The gain of such filter is

$M_{n}(e^{-i \lambda}) = \left| \sum_{j=-r}^{r} \frac{1}{n} e^{-ij\lambda} \right| = \left| \frac{1}{n} \left( 1+2 \sum_{j=1}^{r} cos \lambda_{j} \right) \right| = \left| \frac{sin (n \lambda /2)}{n sin (\lambda /2)} \right|$

Gain of uniform moving average filter

The uniform moving average filter (applied on artificial data)

The Moving Average filter removes a cycle of period n together with its harmonics.

Tagged , , ,

## Some notes on Linear Filters

Let $\{ X_t \}$ and  $\{ Y_t \}$ be two stationary time series related by:

$X_{t} = M_{n}(L)Y_{t} =\sum_{j=- \infty}^{j=\infty} g_{j}Y_{t-j}$

where

$\sum_{j=- \infty}^{j=\infty}|g_{j}| < \infty$ and  $\sum_{j=- \infty}^{j=\infty}|g_{j}|^2 < \infty$

$\{ X_t \}$ is the filtered version of  $\{ Y_t \}$ and $M_{n}(L)$ is the filter. The effect of a linear filter is to change the importance of various cyclical components of the series and/or induce a shift with regard to the position in time.

Tagged , , ,