FUNCTION: OUTLIERS

STUB: result_vector = OUTLIERS( source_vector )


Function OUTLIERS finds the smallest and largest values in the source vector and replaces those values with the average value of the neighboring points.

Many times a value that stands out in a collection of values (such as a vector, in our case) is an errorneous one or a statistically upnormal one.

Sometimes the error is from the data vendor or from a mistake by a trader on the trading floor that was not corrected on time, and sometimes the value is an over-reaction to some news.

Such extreme values are called outliers in statistics (because they lie on the outside of what is normal!)

If you need to remove multiple pairs of outliers, you can call the OUTLIERS function multiple times.