BLOCKAVG

Purpose:

Computes a non-overlapping block average of a series.

Syntax:

BLOCKAVG(series, N, "naflag")

series

-

A series or table

N

-

An integer, the points per non-overlapping block to average as the series is processed.

"naflag"

-

Optional. A string, the NA handling method.

"omitnan"

:

ignore NA values (default)

"includenan"

:

include NA values

Returns:

A series or table, the N point block average.

Example:

W1: 1..12

W2: blockavg(W1, 2)

 

W2 == {1.5, 3.5, 5.5, 7.5, 9.5, 11.5}

Example:

W3: 1..12

W4: blockavg(W3, 3)

 

W4 == {2, 5, 8, 11}

Example:

W1: {1, 2, 3, 4, 5, nan, 7, 8, nan, 10, 11, 12}

W2: blockavg(W1, 3)

W3: blockavg(W1, 3, "includenan")

 

W2 == {2, 4.5, 7.5, 11}

W3 == {2, nan, nan, 11}

 

W2 ignores all NA values by removing the NaN from the segment and adjusting the segment size.

 

W3 includes NaNs and produces an NaN if the segment includes an NaN.

Remarks:

BLOCKAVG computes the N-point non-overlapping block average of a series by decimating the standard N-point moving average.  If the block size is not an integral fraction of the series length, the end points are not averaged.

 

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

 

See MOVAVG to compute an N-point moving average.

 

See BLOCKMEDIAN to compute the block median of a series.

 

See XBLOCKAVG to compute the moving block average based on a X duration.

See Also:

AVGFILT

BLOCKMAX

BLOCKMEDIAN

BLOCKMIN

BLOCKRMS

MOVAVG

MOVMEAN

MOVSTD

XBLOCKAVG