Cumulative sums of a series or of the elements of a matrix.
• Compute the sum of the values in the series x from the start of the workfile or sample s, up to the current observation:
Syntax: @cumsum(x[, s])
x: series
s: (optional) sample string or object
Return: series
• Compute the cumulative sum of the elements of the matrix in vec order.
Syntax: @cumsum(m)
m: matrix, vector
Return: matrix, vector
Compute the cumulative sum of the values in x from the start of the workfile or sample s, up to the current observation:
This function is panel aware.
Examples
series x = @cumsum(@nrnd)
generates a random walk process x with standard normal errors, initialized at a draw from the standard normal distribution.
Cross-references
For the backward variant of this function for series, see
@cumbsum.