Moving Average

This node calculates the moving average of a column. The moving average values are displayed in a new column appended at the end of the table or (if selected) replaces the original columns. For all window based methods (Backward/Center/Forward simple/Gaussian, Harmonic Mean) the cells that do not have a complete window (final at the beginning and the end of the table) are filled with Missing Values.

Options

Type of Moving Average
Select the moving average method defining how values in the window are weighted (backward, centered, forward, Gaussian, cumulative, exponential variants, harmonic mean, etc.).
For the Gaussian weighted moving average the individual values are weighted based on the position in the window.
gauss(i,mean,std_dev) = Math.exp((-0.5) * (i - mean) * (i - mean) / std_dev^2)
std_dev = (k - 1) / 4
For the exponential moving average the individual values are weighted as
alpha = 2/(k+1)
  • Backward simple:
    Backward_simple_n = 1/k * sum{v_n-(k-1) ... v_n}
  • Center simple:
    Center_simple_n = 1/k * sum{v_n-(n-1)/2 ... v_n ... v_n+(n-1)/2}
  • Forward simple:
    Forward_simple_n = 1/k * sum{v_n ... v_n+k-1}
  • Backward Gaussian:
    Backward_gaussian_n = sum{i = 0 ... k-1} gauss(i,k-1,std_dev)*v_n-i
  • Center Gaussian:
    Center_gaussian_n = sum{i = 0 ... k-1} gauss(i,(k-1)/2,std_dev)*v_n+(i-(k-1)/2)
  • Forward Gaussian:
    Forward_gaussian_n = sum{i = 0 ... k-1} gauss(i,0,std_dev)*v_n+i
  • Harmonic Mean Center: The harmonic mean can only be used for strictly positive values.
    Center_harmonic_n = n/{sum{i = 0 ... k-1} 1/v_n+(i-(k-1)/2)
  • Cumulative simple:
    Cumulative_n= 1/n * sum{v_0 ... v_n-1}
  • Simple exponential:
    Simple_exponential_0 = v_0
    EMA(v,n) = Simple_exponential_n = alpha*v_n + (1-alpha)*Simple_exponential_n-1
  • Double exponential:
    Double_exponential_n = 2 * EMA(v,n) - EMA(EMA(v,n),n)
  • Triple exponential:
    Triple_exponential_n = 3 * EMA(v,n) - 3 * EMA(EMA(v,n),n) + EMA(EMA(EMA(v,n),n),n)
  • Old exponential:
    Exponential_n = alpha*v_n + (1-alpha) * Backward_simple_n-1
Window length
Number of consecutive rows used to compute each moving average. Must be an odd number for centered methods.
Remove original columns
If checked, the selected input columns are replaced by their moving average. If unchecked, new columns named MA(<column>) are appended.
Column selection
Select the numeric (double compatible) columns for which to compute moving averages. Move columns of interest to the "Includes" list.

Input Ports

Icon
Table containing time series.

Output Ports

Icon
Table with column holding moving average values.

Views

This node has no views

Workflows

Links

Developers

You want to see the source code for this node? Click the following button and we’ll use our super-powers to find it for you.