OUTLIER

Purpose:

Linearly interpolates outlier values based on a logical condition.

Syntax:

OUTLIER(series, condition, endpt)

series

-

A series. The input series to replace outliers.

condition

-

A binary series or logical expression resulting in a binary series. The replacement condition.

endpt

-

Optional. An integer specifying end point handling.

0:

do not replace removed beginning and ending values

1:

replace removed beginning values with the first preserved value and replace removed ending values with the last preserved value (default).

Returns:

A series, or table.

Example:

W1: {1, 3, 9, 1, 2}

W2: outlier(W1, W1 > 3)

 

W2 contains the series {1, 3, 2, 1, 2}. Any value in W1 greater than 3.0 is replaced with the linear interpolation of the preserved neighbors. In this case, W1[3] == 9.0. Thus, W2[3] == 2.0, since this is the linear interpolation between the preserved values of W1[2], the value 3.0, and W1[4], the value 1.0.

Example:

W3: {1, 3, 9, 13, 10, 1, 2}

W4: outlier(W3, W3 > 3);overp(W3, lred);setsym(14)

 

image\outlier.gif

 

Similar to above, except multiple consecutive outliers are replaced with the linear interpolation of the preserved neighboring values. The original data is overplotted onto the result to clearly show the process of outlier interpolation.

Example:

W1: {1, 3, 9, 13, 10}

W2: outlier(W1, W1 > 3)

W3: outlier(W1, W1 > 3, 0)

 

W2 contains the series {1, 3, 3, 3, 3} but W3 contains the series {1, 3}. Since the end points of W1 are outliers, W2 replaces the removed end points with the last preserved value, 3.0. Because W3 does not replace the removed end points, the series is shorter.

Remarks:

OUTLIER uses XYLOOKUP to replace removed outlier values with the linear interpolation of the surrounding preserved values. A value is an outlier if it meets the condition specified by the binary series condition.

 

Consecutive outlier values are replaced with the continued linear interpolation of the preserved neighboring values.

 

If endpt is 1, removed values at the beginning of the series are replaced with the first preserved values and removed values at the end of the series are replaced with the last preserved value.

 

If endpt is 0, removed beginning and ending values are not replaced and the resulting series is shorter than the original input series.

See Also:

DELETE

DECIMATE

INSERT

INTERPOLATE

REMOVE

REPLACE

XYLOOKUP