Moving average

The moving average (also: moving average) is a method for smoothing time - or data series. The smoothing is performed by removing higher frequency components. As a result, a new data point set is created, consisting of the mean values ​​of equal-sized subsets of the original data set of points. In the signal theory, the moving average will be described as a low pass filter with a finite impulse response. In the equal-weighted form, the moving average is the simplest FIR low- pass filter dar.

Applies the moving average, for example, in the analysis of time series. The equal-weighted variant corresponds to the convolution with a rectangular function and leads to a number of problems, which can be counteracted with special weights.

Basic Procedure

The amount of moving averages are calculated iteratively ( " sliding " ) calculates the "window" of a given signal over a cut. The window used is shifted to overlap, that is, repeated the first value is excluded from the consideration neckline and added taken the first value after the cut. For the calculation of the average value occurring in the window values ​​can then be weighted differently.

The resulting new set of averages is taken independently for themselves; however, it is often brought into the context of a position of the input quantity which is also called a hot spot. The hot spot may be in the area of ​​the window, but does not. In time series, the last time is often used as a hot spot; in other applications are centered pictures usual.

A simple moving average

The simple moving average (English simple moving average ( SMA) ) n -th order of a discrete time series is the result of the arithmetic mean values ​​of n consecutive data points. Because it is a time series, the hot spot is located at the last stage. The following considerations apply to this special case.

Analogous to filters with finite impulse response is also known as the order.

Such a moving average has a delay ( group delay ) of, ie " lag " the averaged values ​​to units of time afterwards.

This delay can be corrected by moving the moving average to. This is the so-called mean -centered. But then no more values ​​for the last time units are available. This gap can only be closed or at least reduced by using a lower -order, different weightings or an estimator.

The centered simple moving average of order 3 is thus by

Given.

An example of the use of such moving averages are the 38 - and 200-day averages of market prices, describe the moving average of the past n trading days of a stock price.

A moving average filter is a low pass filter but individual frequency ranges to be filtered more or less and it comes to signal shifts (English lags ).

Online calculation

By the overlap in the calculation of the running average of two consecutive points, the sum of ( n-1) points is calculated twice. To reduce this redundant effort is, there exists an online algorithm, which makes do with only two additions and multiplications per average:

Since this is a recursive calculation, this corresponds to a filter with infinite impulse response. In practice, such a filter can be implemented only with finite precision values ​​, so it can be unstable due to effects such as rounding errors or cancellation, the filter.

Weighted moving average

The weighted moving average m (t) of order n of a time series x (t) - a finite impulse response filter similar to - defined as:

Here wi represents the weighting of the respective data points represent (equivalent to the impulse response of the filter). If the filter is not causal but Also taken into account future values ​​in the averaging. The sum of all weights must be 1 arise because otherwise additionally there is a gain ( attenuation).

An example is the centered binomial filter with third-order and

Spectral Properties

If one forms the centered moving average of order of a weakly stationary time series with spectral density then has the filtered spectral density

By the transfer function

Where the Fejér kernel called. To the graphical representation of the transfer function can be seen with the low-pass property: frequencies close to 0 are not damped. On the other hand, this simple filter, the usual response in the convolution with a square wave signal. When a filter width of 3, the frequencies are increasingly attenuated to the point until complete suppression. Frequencies that are present beyond that point will not be also suppressed as, but occur with inverted phase.

The smallest binomial filter with an odd width and with the weights is a low pass filter with for all frequencies. It attenuates the frequencies to increase and with a constant phase shift.

Linear weighted moving average

A linear weighted moving average (English: linear weighted moving average ( LWMA, mostly: WMA ) ) assigns the data points linearly increasing weights, that is, the further the values ​​are in the past, the lower its influence:

Exponentially smoothed average

The exponentially smoothed average assigns the data points of a time series exponentially decreasing weights. Thus, here recent data points are weighted more heavily than more distant, but still stronger than the weighted moving average.

Since the exponential average involves not only values ​​from the time series, but also previous averages, it represents an infinite impulse s response A key advantage is its much shorter delay with the same smoothing.

268695
de