MOVMAX

Purpose:

Performs an N-point centered moving maximum calculation.

Syntax:

MOVAX(series, N, "naflag", "edgeflag")

series

-

A series or table

N

-

An integer, the segment size. The number of points to process as the series is traversed.

"naflag"

-

Optional. A string, the NA handling method.

"omitnan"

:

ignore NA values (default)

"includenan"

:

include NA values

"edgeflag"

-

Optional. A string, the edge processing flag.

"discard"

:

only process segments of length N, ignore partial segments

"shrink"

:

shrink the size of both the start and end segments to the actual number of samples in the segments (default)

"legacy"

:

only shrink the starting segments to the actual number of samples

Returns:

A series or table.

Example:

W1: {2, 3, 1, 5, 2, 4, 5, 7, 2}

W2: movmax(W1, 3)

W3: movmaximum(W1, 3)

 

W2 == {3, 3, 5, 5, 5, 5, 7, 7, 7}

W3 == {2, 3, 3, 5, 5, 5, 5, 7, 7, 7, 3}

 

W2 computes the centered 3-point moving maximum where the result at point N is the maximum of points N-1, N and N+1. The computation starts at sample 2.

 

W3 computes the non-centered 3-point moving maximum.

Example:

W1: {2, 3, 1, 5, nan, 4, 5, 7, 2}

W2: movmax(W1, 3)

W3: movmax(W1, 3, "omitnan")

W4: movmax(W1, 3, "includenan")

 

W2 == {3, 3, 5, 5, 5, 5, 7, 7, 7}

W3 == {3, 3, 5, 5, 5, 5, 7, 7, 7}

W4 == {3, 3, 5, nan, nan, nan, 7, 7, 7}

 

Both W2 and W3 ignore the NaN values.

 

W4 returns NaN for any segment that includes one or more NaN values.

Example:

W1: {2, 3, 1, 5, 2, 4, 5, 7, 2}

W2: movmax(W1, 3, "shrink")

W3: movmax(W1, 3, "discard")

W4: movmax(W1, 3, "legacy")

 

W2 == {3, 3, 5, 5, 5, 5, 7, 7, 7}

W3 == {3, 5, 5, 5, 5, 7, 7}

W4 == {2, 3, 3, 5, 5, 5, 5, 7, 7}

 

W2 computes a 3 point centered moving maximum where the result at point N is the maximum of points N-1, N and N+1. The result is identical to the first example.

 

W3 computes a 3 point moving maximum for overlapping segments that contain exactly 3 samples. Shorter segments at the start and end edges are discarded.

 

W4 computes a 3 point moving maximum where the maximum of each overlapping moving segment of length 3 is computed but the segment length adjusts from 1 to 3 at the start edge only. The output length is the same as the input length. This option reproduces the behavior of MOVMAX implemented in previous versions.

Remarks:

MOVMAX computes a centered moving maximum by centering the result within the N-point sliding segments. The output length is the same as the input length.

 

NaN values are ignored by default. Set naflag to "includenan" to process NaN values.

 

For edgeflag == "discard", only segments that contain exactly N samples are processed. Shorter segments at the start and end edges are discarded.

 

For edgeflag == "legacy", the first N-1 points returned by MOVMAX given an N-point window are the maximum values in consecutively larger segments of size 1, 2, 3, ... , N-1. The processing stops after the last full N point segment. The output length is the same as the input length. This reproduces the behavior of prior versions of MOVMAX.

 

See MOVMAXIMUM to compute a non-centered moving maximum.

 

See BLOCKMAX to compute the moving maximum of non-overlapping blocks.

See Also:

BLOCKMAX

MOVAVG

MOVMAXIMUM

MOVMIN

MOVMINIMUM