MOVMINIMUM

Purpose:

Performs an N-point moving minimum calculation.

Syntax:

MOVMINIMUM(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.

"full"

:

process all segments (default)

"center"

:

center the result within the overlapping N point segments

"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

"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: movminimum(W1, 3)

W3: movmin(W1, 3)

 

W2 == {2, 2, 1, 1, 1, 2, 2, 4, 2, 2, 2}

W3 == {2, 1, 1, 1, 2, 2, 4, 2, 2}

W4 == {2, 1, 1, 1, 2, 2, 4, 2, 2}

 

W2 computes the non-centered 3-point moving minimum. The first point of W2 is the first point of W1 and the second point is the minimum of the first two points of W1. The second to last point of W2 is the minimum of the last two points of W1 and the last point is the last point of W1.

 

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

 

W4 computes the same centered 3-point moving minimum as W3.

Example:

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

W2: movminimum(W1, 3, "full")

W3: movminimum(W1, 3, "shrink")

 

Both W2 and W3 return the series: {2, 2, 1, 1, 1, 2, 2, 4, 2, 2, 2}.

Example:

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

W2: movminimum(W1, 3)

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

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

 

W2 == {2, 2, 1, 1, 1, 4, 4, 4, 2, 2, 2}

W3 == {2, 2, 1, 1, 1, 4, 4, 4, 2, 2, 2}

W4 == {2, 2, 1, 1, nan, nan, nan, 4, 2, 2, 2}

 

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, nan, 4, 5, 7, 2}

W2: movminimum(W1, 3, "includenan", "center")

 

W2 == {2, 1, 1, nan, nan, nan, 4, 2, 2}

 

Similar to above except W2 computes a 3-point centered moving minimum where the result at point N is the minimum of points N-1, N and N+1. Any segment that includes one or more NaN values returns NaN.

Example:

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

W2: movminimum(W1, 3, "center")

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

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

 

W2 == {2, 1, 1, 1, 2, 2, 4, 2, 2}

W3 == {1, 1, 1, 2, 2, 4, 2}

W4 == {2, 2, 1, 1, 1, 2, 2, 4, 2}

 

W2 computes a 3-point centered moving minimum where the result at point N is the minimum of points N-1, N and N+1.

 

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

 

W4 computes a 3-point moving minimum where the minimum 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 MOVMIN implemented in previous versions.

Remarks:

MOVMINIMUM computes a non centered N-point moving minimum.

 

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

 

By default or with edgeflag == "full" or edgeflag == "shrink", the first N-1 points returned by MOVMINIMUM given an N-point window are the minimum values in consecutively larger segments of sizes 1, 2, 3, ... , N-1. The last N-1 points are the minimum values of consecutively smaller segments of sizes N-1, N-2, ..., 2, 1. The output length is L + N - 1 where L is the length of the input series.

 

For edgeflag == "center", the result is centered within the N-point segment and the output length is the same as the input length.

 

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 start segments are processed in the same manner as "full", but the processing stops at the last block of N samples. This reproduces the behavior of prior versions of MOVMIN .

 

See MOVMIN to compute a centered moving minimum.

 

See BLOCKMIN  to compute the moving minimum of non-overlapping blocks.

See Also:

BLOCKMIN

MOVAVG

MOVMAX

MOVMAXIMUM

MOVMIN