NxSMA - Seasonal Moving-average Filter

Computes Seasonal (aka. double) moving average (aka. KxM MA).


NxSMA(X, Order, K, N, EndPoints)

is the univariate time series data (a one-dimensional array of cells (e.g., rows or columns)).
is the time order in the data series (i.e., the first data point's corresponding date (earliest date = 1 (default), latest date = 0)).
Order Description
1 Ascending (the first data point corresponds to the earliest date) (default).
0 Descending (the first data point corresponds to the latest date).
is the number of terms (aka points) of the second moving average filter. If missing, K is assumed 1.
is the number of terms (aka points) in the first moving average filter (e.g., seasonal length). If missing or omitted, N is assumed 1.
is a logical value for applying asymmetric weights at the end of the series. If missing or omitted, Endpoints = False, and no treatment for Endpoints is performed.


  1. The time series is homogeneous or equally spaced.
  2. The time series may include missing values (e.g., #N/A) at either end.
  3. The NxSMA returns an array-type value back to Excel. The user must use CTRL+ALT+ENTER to show returned values.
  4. The number of terms (i.e., K+N-1) in NxSMA must be an odd number. In effect, K and N can be either both odd numbers or both even numbers.
  5. In practice, the NxSMA is known as the double moving average filter: which combines two MA to form a symmetric two-sided moving average filter.
  6. Why use NxSMA? When working with time series you often smooth to remove seasonality effects, which requires a period (aka moving window) to be equal to a seasonal length, which is often an even number, for example, 12 months or 4 quarters. In this case, we use the double moving average (e.g., 2x4 for quarterly data, or 2x12 for monthly data, etc.).
  7. Mathematically, the order in which the MA filters are applied does not matter, and they will return the same results. For our application,
  8. The weights or the multiplying factors of the NxSMA filter are derived by taking the convolution of the two moving average filters (K-MA and N-MA).
  9. The weights or the multiplying factors of the NxSMA are calculated as follows: $$w_j=\left\{\begin{matrix} \frac{j}{K\times M} & j < K\\ \frac{1}{M}& K \leq j \leq M\\ \frac{M+K-j}{K\times M} & M+K > j > M \end{matrix}\right.$$
  10. By definition, the sum of all weights in the SMA is equal to one(1).
  11. The NxSMA function is available starting with version 1.66 PARSON.

Files Examples

Related Links



Article is closed for comments.

Was this article helpful?
0 out of 0 found this helpful