This is the definition of linear filter from a book I am reading:
A second procedure for dealing with a trend is to use a linear filter, which converts one time series, $\{x_t\}$, into another, $\{y_t\}$, by the linear operation $$y_t = \sum_{r = -q}^{+s} a_r x_{t+r}$$ where $\{a_r\}$ is a set of weights. In order to smooth out local fluctuations and estimate the local mean, we should clearly choose the weights so that $\sum a_r = 1$, and then the operation is often referred to as a moving average. Moving averages are discussed in detail by Kendall et al. (1983, Chapter 46), and we will only provide a brief introduction. Moving averages are often symmetric with $s = q$ and $a_j = a_{-j}$. The simplest example of a symmetric smoothing filter is the simple moving average, for which $a_r = 1/(2q + 1)$ for $r = -q, \ldots, +q$, and the smoothed value of $x_t$ is given by $$\textrm{Sm}(x_t) = \frac{1}{2q + 1}\sum_{r=-q}^{+q} x_{t+r}$$
It is said there that $\{a_r\}$ is a set of weights and in order to call the operation a moving average we should clearly choose the weights so sum of $a_r$ is equal to 1.
Then it is described that the moving averages are often symmetric with $s = q$ and $a_j = a_{-j}$. So the simple moving average for which $a_r = 1/(2q + 1)$ for $r = -q, \ldots, +q$ is $\textrm{Sm}(x_t)$
But when I tried to confirm that the sum of $a_r$ for simple moving average equal 1 I got this:
Is there something I misunderstood?
