next up previous contents
Next: Autoregressive Time Series Up: Filters Previous: Linear Systems

Moving Average Filters

The moving average filter as described can be modified in a number of ways: we can take more than three numbers, we can insist that the filter be causal which means that the output at time k cannot require knowledge of the input at a later time, and the averages can be weighted. If I give you the numbers one quarter, one half, one quarter, with the instruction to add one quarter of yesterdays Dow Jones to half of today's to one quarter of tomorrows, we output (a day late) a weighted moving average. The histogram of three numbers, one quarter, half, one quarter, is a sort of blurring mask which we run over the time series to modify it. we can regard it as a function defined from ${\fam11\tenbbb Z}$ to ${\fam11\tenbbb R}$ which is zero except at -1,0 and 1, where it takes the given values. You may be reminded of the blurring done by morphology techniques.

Definition 13992

If f and g are functions from ${\fam11\tenbbb Z}$ to ${\fam11\tenbbb R}$, the convolution of f with g, written $f \ast 
g$, is a new function from ${\fam11\tenbbb Z}$ to ${\fam11\tenbbb R}$ defined by

\begin{displaymath}
f \ast g (n) = \sum_{i=-\infty}^\infty f(n-i)g(i) \end{displaymath}

It is clear that I smooth f by performing a convolution with a suitable g. What I do is to compute the new, smoothed function $f \ast 
g$ at a point n by centring g on n (that is move the 0 value of g over n) and then multiply the corresponding values of f and g and sum them. You might think I have written g backwards, but in this form it works if both functions are defined for the non-negative numbers only. A variant with an integral sign for the case of continuous functions defined on ${\fam11\tenbbb R}$ or ${\fam11\tenbbb R}^+$ is left as an exercise for the student.

If f is not defined for all values of ${\fam11\tenbbb Z}$, then I need to do some obvious fiddling, like making f(n) zero when n is negative or changing the limits on my summation. Since filters, to be implementable, must have only a finite number of terms, in practice one is rather restricted to smoothing envelopes g which are non-zero for only a finite (and usually pretty small) number of values.

If the values of g are allowed to be negative some rather surprising things can happen, and it is useful to experiment by obtaining some time series, writing down a Moving Average filter g, and performing the convolution in a program to see what comes out. In particular, it is possible to input white noise and get out a time series which manages to look deeply significant. White noise is, for those who don't know, noise which has equal spectral representation at all frequencies, and is hence entirely mythical. Approximations to it over the audio spectrum sound like surf on a beach and are said to be very soothing to listen to. Well, more soothing than most things one hears on the radio these days, at least. One can produce quite reasonable simulations of gaussian white noise by choosing, for each clock tick, quite independently, a random number according to a gaussian or normal distribution with mean zero and variance one. The resulting graph or signal looks a mess. If you haven't got a gaussian die to throw, fiddling your random number generator to produce an approximation to one is an exercise which is almost as soothing as listening to the result played back through a speaker, and gives a somewhat greater sense of accomplishment.

If we take it that g, the function with which we propose to accomplish a smoothing, consists essentially of a small number of non-zero numbers, we can refer to them as the coefficients in the Moving Average filter, and then a filter of order k has just that number of coefficients. More accurately, we can take the set of k numbers

\begin{displaymath}
b_0, b_1, \cdots, b_{k-1}\end{displaymath}

and filter u to v by

\begin{displaymath}
\forall n \in {\fam11\tenbbb Z}, v(n) = b_0 u_n + b_1 u_{n-1} 
+ \cdots + b_{k-1} u_{n-k+1} \end{displaymath}

so as to get a causal MA filter determined by the filter-vector of coefficients. Moreover, we could extend the idea by having a Moving Average filter which changed as we move along the time axis. It had better not change too fast, or the process is unlikely to be intelligible in terms of changing filters, but if we take a moving average family of filter vectors which change in time, we can use this to model speech. Instead of using white noise as input, we can use a pulse at the frequency of the pitch of a human voice, and argue that what our filter family is doing is modelling the way the vocal tract acts on the vocal chords to produce a sound. This is conceptually fairly straightforward, and gives an idea of a class of models, even if it lacks a certain amount of necessary detail.


next up previous contents
Next: Autoregressive Time Series Up: Filters Previous: Linear Systems
Mike Alder
9/19/1997