Cumulative process of negative (below threshold) changes.
Compute the partial sum process of negative (below the threshold y) changes in the series beginning in the specified date.
Syntax: @cumdn(x, d[, y, s])
x: series
d: string
y: (optional) number
s: (optional) sample string or object
Return: series
Consider the partial sum decomposition of a variable
given a initial value
as
where
,
, and
are the partial sum processes of the differences for positive, negative, and zero
changes in
relative to the threshold
y:
This function returns the negative partial sums
for the current or specified sample.
• The date
d specification determines
.
• Values for dates prior to d will be NAs.
• The optional
argument specifies the threshold value. By default
.
This function is panel aware.
Examples
The code below produces a graph of a sine wave x and @cumdn applied on x.
wfcreate u 50
series x = @sin(@pi*@trend/4)
group g x @cumdn(x,1)
g.line
Cross-references