Cumulative Window Functions (cum-functions)
The cumulative window starts with a fixed left boundary, and expands its right boundary to one more step size every step until the max window size.DolphinDB provides the cum-functions for cases involving cumulative windows.
Introduction
higher-order function accumulate (:A):
$ accumulate(func, X, [init])
Note: If init is specified, the result for the first window is init + X[0]
.
A general template of the built-in cum-functions:
$ cumfunc(X)
$ cumfunc(X, Y)
Parameters
X (Y) is a scalar/vector/matrix/table.
List of Functions
See also
cumfunc(X)
cummax, cummin, cummed, cumfirstNot, cumlastNot, cumrank,
cumcount, cumpercentile, cumstd, cumstdp, cumvar, cumvarp,
cumsum, cumsum2, cumsum3, cumsum4, cumavg, cumprod, cumPositiveStreak.
cumfunc(X, Y)
Windowing Logic
The cum-function performs a cumulative calculation on each element, then returns a vector of the same length (or matrix of the same dimension) as the input.
The following example illustrates the calculation rules:
$ X = 1 1 2 3 4 5 NULL 8 9 1 3
$ cumsum(X)
[1, 2, 4, 7, 11, 16, 16, 24, 33, 34, 37]
