5
$\begingroup$

The moving average is defined as

A method of smoothing a time series to reduce the effects of random variation and reveal any underlying trend or seasonality.

(Oxford Dictionary of Statistics, ed. by Graham Upton and Ian Cook)

What if we apply similar measures to non-time series data? E.g. if we plot (say) height on the x axis and weight on the y axis, we could do something very similar to an MA.

Is this still called a moving average? Or does it have some other name? (A general term would be a smooth, but MA is a specific kind of smooth).

$\endgroup$
  • 1
    $\begingroup$ Well... it is good to be specific. :) $\endgroup$ – usεr11852 May 2 '19 at 17:33
  • 2
    $\begingroup$ @usεr11852 It has no claim to being a KDE unless the x-values are equally spaced. You could convert it into a kind of density estimator by dividing each windowed average by some estimate of the length corresponding to the underlying x values. $\endgroup$ – whuber May 2 '19 at 22:09
  • 3
    $\begingroup$ Wouldn’t it still be a moving average but with the dependent variable “moving” in a different dimension other than time? In this case the dimension along which weight is moving is height. I guess there is the philosophical issue that time is accepted as having an arrow along which the average moves whereas height doesn’t... you can move in both directions, or rather you aren’t really moving at all. Huh. This is a tough one. $\endgroup$ – Brash Equilibrium May 3 '19 at 0:30
  • 4
    $\begingroup$ It is a kernel smoother. Specifically en.wikipedia.org/wiki/Kernel_smoother#Nearest_neighbor_smoother And it doesn't have to be centered, neighbors can be chosen to be smaller than the current point to imitate a MA smoother. $\endgroup$ – Cagdas Ozgenc May 4 '19 at 20:31
  • 1
    $\begingroup$ @CowboyTrader: Agreed (I accidentally wrote KDE mostly because I was working on a Kernel Smoother to get a KDE recently.) I cannot see any other reasonable answer to Peter's question. (+1) $\endgroup$ – usεr11852 May 5 '19 at 23:16
7
+50
$\begingroup$

A Moving Average Filter is a special case for a Finite Impulse Response (FIR) Filter, where equal weights are used that add up to unity.

Note that in the case of time sampled data the result of the averaging is written for the time index of the most recent data point in the averaging window, hence the name filter. If another index is used then this is interpreted as usage of future information, and the procedure is called smoothing.

A Moving Average Filter/Smoother clearly operates based on the assumption that the underlying state changes slowly hence can be recovered by locally averaging in order to reduce the observation noise.

If our indexing is based on another variable then we are not doing something very different. Time indexing can be thought as random sampling from a uniform distribution. Applying a similar local averaging idea in this case corresponds to kernel regression or kernel smoother.

Since there is no time component the filter vs smoother distinction is not very relevant (likewise whether the filter being a causal filter or not).

We are also flexible on the weights. If we use a uniform kernel equal weighting of Moving Average will be imitated. Other kernels are clearly applicable similar to FIR.

The main distinction comes when determining the neighborhood. In the time samples, equal distance sampling is usually assumed. In the regression case a more sophisticated distance metric needs to be employed. For a single independent variable this is not much of a concern (the distance on a line is very intuitive). But if there are many independent variables then the distance calculation severely affects which data points to be included in the averaging.

| cite | improve this answer | |
$\endgroup$
  • $\begingroup$ There are definitions or versions of smoothing that exclude future values, e.g. exponential smoothing. $\endgroup$ – Nick Cox May 8 '19 at 11:28
  • $\begingroup$ We can all define terms the way we like. The questions then are whether the definitions are clear, agree with other definitions and are matched by practice. Trivially, but importantly, different fields have different perspectives too, e.g. if someone approaches this from an engineering background. $\endgroup$ – Nick Cox May 8 '19 at 12:05
5
$\begingroup$

Terminology can differ between fields even apparently sharing applications. Based on statistical theory and practice in several fields (time series, spatial series, any application where a response may be smoothed as a function of predictors) I propose simply that a moving average is still a moving average outside a time series context.

There is no good reason to include as part of a definition of moving average that the application must be to time series. In practice, that is likely to be the most common application and also the example that people meet first, but neither fact is decisive in principle.

It's not even crucial that you have

  • at most one non-missing value at each point

  • regularly spaced values

on the dimension or dimensions you are averaging over. (On dimensions, note that averaging over values at neighbouring points in space is often helpful.)

You can always define sets of weights (kernels) that are general enough to cope with such complications. I assert that weights that decline with time or distance from the point being averaged for are often more useful than equal weights. Whether an average should be asymmetric (e.g. only considering "earlier" points) is up for discussion too.

So, to make a key point now explicit, I see no reason to define moving averages as being based on equal weights. In time series analysis, equal weights are often used, but that is a matter of convention or simplicity at most. Basic theory and practice combine to show that equal weights have unfortunate properties in the frequency domain and are especially sensitive to outliers as averages can jump when an outlier leaves or enters the window, often although not always regarded as undesirable.

Note that we can be flexible about what is an average in this context as well as any other. Prefer medians? trimmed means? Being clear about what you're doing is the main imperative about use of terminology.

The term scatter plot smoother fits some applications that are not time series, but clearly not all.

| cite | improve this answer | |
$\endgroup$
  • 1
    $\begingroup$ On the style issue, I agree with @CowboyTrader. More intuitively, in a moving average with time, there's a sense of "moving". Nevertheless +1 for your helpful answer. $\endgroup$ – Peter Flom May 8 '19 at 12:04
  • 1
    $\begingroup$ You can move in any predictor space and that's how these averages are calculated. I don't rule out averaging on a circular domain either. $\endgroup$ – Nick Cox May 8 '19 at 12:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.