A moving average replaces each value by an average over a moving window of neighboring values. The simple trailing version with positive integer window length is the causal filterIt is a finite impulse response linear time-invariant system. A constant input remains unchanged because the weights sum to one. Weighted and centered averages are other choices; the definition of the window determines both the weights and whether future values are needed.
For an exact five-sample example, letdefined at every integer index. The first component completes one cycle in forty samples and the second in five. Averaging five consecutive samples cancels the second component exactly. The first becomesThe remaining component is slightly smaller and delayed by two samples; the filter does not recover the original component unchanged.
The example is in steady operation: its early output values use the specified negative-index samples. Starting a device at with an unknown past requires an initialization rule. Treating earlier samples as zero, shortening the initial window, and postponing output until a full window is available produce different initial values.
For zero-mean uncorrelated random variables with common variance , the averaged disturbance hasThe standard deviation decreases by , but successive filtered errors share samples and are generally correlated. This variance calculation also assumes the wanted component is not damaged by averaging. A rapidly changing feature can be suppressed along with the disturbance.
The frequency response explains the cancellation and limits of this method. A moving average preserves low frequencies comparatively well, yet its side lobes make it a poor substitute for a sharply selective frequency cutoff. Smith develops this time-domain versus frequency-domain distinction in The Scientist and Engineer's Guide to Digital Signal Processing, chapter 15: moving-average filters.
A moving average is a statistical calculation used to analyze data points by creating averages of different subsets of the data. It is commonly used in time series analysis, financial markets, and trend analysis to smooth out short-term fluctuations and highlight longer-term trends or cycles. There are several types of moving averages, including: 1. **Simple Moving Average (SMA)**: This is the most common type, calculated by taking the arithmetic mean of a specific number of recent data points.
New to topics? Read the docs here!
