MOVMIN

Purpose:

Performs an N-point centered moving minimum calculation.

Syntax:

MOVMIN(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: movmin(W1, 3)

W3: movminimum(W1, 3)

 

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

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

 

W2 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.

 

W3 computes the non-centered 3-point moving minimum. The first 2 points in the returned series are the minima of the 1 and 2 point segments and the last two points are the minima of a 2 and 1 point segments.

Example:

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

W2: movmin(W1, 3)

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

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

 

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

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

W4 == {2, 1, 1, nan, nan, nan, 4, 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, 2, 4, 5, 7, 2}

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

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

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

 

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

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

W4 == {2, 1, 1, 1, 2, 2, 4, 2, 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. The result is identical to the first example.

 

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:

MOVMIN computes a centered moving minimum 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 MOVMIN given an N-point window are the minimum 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 MOVMIN.

 

See MOVMINIMUM to compute a non-centered moving minimum.

 

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

See Also:

BLOCKMIN

MOVAVG

MOVMAX

MOVMINIMUM