Investment Studio > Expressions > Functions > Statistical > HARMEAN

float harmean(float data [, ...])

Returns the harmonic mean of the data (the reciprocal of the arithmetic mean of the reciprocals): given N data points,

1 / harmean = (1 / data1 + 1 / data2 + ... 1 / dataN) / N

No value in the argument list may be <= 0.

All elements in the argument list are converted to floats, with exclusion if conversion fails. The list may contain array arguments, in which case each array element is treated as a separate list element.

While the arithmetic mean (see average) answers the question "if all the data points had the same value, what would that value have to be in order to leave the sum of all data points unchanged?", the harmonic mean answers the question "if all the data points had the same value, what would that value have to be in order to leave the sum of the reciprocals of all data points unchanged?".

Example

A stock price moves from USD 20 to USD 40 in 30 trading days, and then back down to USD 20 in 15 trading days. The average daily price move for the entire round trip is

=harmean((40 - 20) / 30, (40 - 20) / 15)

» 0.88 USD / day.

See also average, geomean, median, trimmean.