MOVMEDIAN

Purpose:

Calculates the moving median of a series.

Syntax:

MOVMEDIAN(series, N, rampflag)

series

-

A series or table.

N

-

An integer, the number of points to calculate the median as the series is processed.

rampflag

-

Optional. An integer, endpoint median flag.

0:

none

1:

up and down (default)

Returns:

A series or table.

Example:

W1: 1..5

W2: movmedian(W1, 3)

W3: movmedian(W1, 3, 0)

 

W2 == {1, 1.5, 2, 3, 4, 4, 5}

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

 

The moving median computation in W2 "ramps" up and down at the beginning and end of the series whereas the moving median computation of W3 assumes the series consists of 0 values before the beginning and after the end.

Remarks:

In particular, for series x of length N, movmedian(x, 3) returns the following N+2 length series:

 

 

If rampflag is 0, movmedian(x, 3, 0) returns the following N+2 length series:

 

 

 

For multi-column series, MOVMEDIAN computes the moving median on each column.

 

See SORT for a description of the sorting algorithm used to compute the median of each segment.

 

See MEDIAN to compute the median of the entire series.

 

See BLOCKMEDIAN to compute the non-overlapping block median of a series.

See Also:

BLOCKMEDIAN

COLMEDIAN

MEDIAN

MEDFILT1

MOVAVG

SORT