mwsum#

swordfish.function.mwsum()#

Calculate the moving sums of X with Y as weights in a sliding window.

The weights in a rolling window are automatically adjusted so that the sum of weights for all non-null elements in the rolling window is 1.

Parameters:
  • Y (Constant) – A vector/matrix/table/tuple (with scalars or equal-length vectors)/dictionary.

  • X (Constant) – A vector/matrix/table/tuple (with scalars or equal-length vectors)/dictionary.

  • window (Constant) – An integer no smaller than 2 or a scalar of DURATION type indicating the size of the sliding window. Note: The window size is capped at 102400 when m-functions are used in the streaming engines.

  • minPeriods (Constant, optional) – A positive integer indicating the minimum number of observations in a window required to be not null (otherwise the result is NULL).