CUMMAX

Purpose:

Calculates the cumulative maximum of a series.

Syntax:

CUMMAX(series, dim, "naflag", "cmpflag")

series

-

A series or array, the input series.

dim

-

Optional. An integer or string, the computation dimension.

1

:

calculate column-wise (default)

2

:

calculate row-wise

"naflag"

-

Optional. A string, the NA handling method.

"includenan"

:

include NA values

"omitnan"

:

ignore NA values (default)

"cmpflag"

-

Optional. A string, the complex compare method.

"abs"

:

Compare complex values based on the magnitude, use phase to break ties (default)

"real"

:

Compare complex values based on the real part, use the imaginary part to break ties.

Returns:

A series or table.

Example:

cummax({20, 15, 30, 10, 25})

 

returns {20, 20, 30, 30, 30}.

Example:

W1: integ(gnorm(1000, 1))

W2: cummax(W1)

 

max(W1) == W2[end]

 

The last point of CUMMAX is the overall maximum of the input data.

Example:

W1: {20, 15, nan, nan, 25}

W2: cummax(w1)

W3: cummax(w1, "omitnan")

W4: cummax(w1, "includenan")

 

W2 == {20, 20, 20, 20, 25}

W3 == {20, 20, 20, 20, 25}

W4 == {20, 20, nan, nan, nan}

 

Both W2 and W3 ignore the NaN values.

 

Because W4 contains and includes NaN values, the cumulative maximum becomes and remains NaN after the first occurrence.

Example:

W1: {3 + i, -4 + 2i, 2 + 3i, 2 + 4i, 8 + 5i}

W2: cummax(w1)

W3: cummax(w1, "abs")

W4: cummax(w1, "real")

 

W2 == {3 + i, -4 + 2i, -4 + 2i, -4 + 2i, 8 + 5i}

W3 == {3 + i, -4 + 2i, -4 + 2i, -4 + 2i, 8 + 5i}

W4 == {3 + i,  3 +  i,  3 +  i,  3 +  i, 8 + 5i}

 

Both W2 and W3 compare complex values based on the magnitude.

 

W4 compares complex values based on the real part.

Remarks:

CUMMAX calculates the cumulative maximum of a series.

 

The nth value of the output series is equal to the maximum of the first n points of the input series.

 

The naflag option defaults to "omitnan" which causes NaN values to be ignored during computation.

 

The cmpflag option is ignored for real series.

 

See CUMMIN for the cumulative minimum.

See Also:

CUMAVG

CUMMIN

CUMPROD

CUMSUM

MAX