Language Reference


GEOMEAN Function

GEOMEAN (matrix);

The GEOMEAN function returns a scalar that contains the geometric mean of the elements of the input matrix. The geometric mean of a set of nonnegative numbers $a_1, a_2,\ldots ,a_ n$ is the nth root of the product $a_1 \cdot a_2 \cdots a_ n$.

The geometric mean is zero if any of the $a_ i$ are zero. The geometric mean is not defined for negative numbers. If any of the $a_ i$ are missing, they are excluded from the computation.

The geometric mean can be used to compute the average return on an investment. For example, the following data are the annual returns on U.S. Treasury bonds from 1994 to 2004. The following statements compute the average rate of return during this time. The output, shown in FigureĀ 24.145, shows that the average rate of return was 6.43%.

/*         year  return% */
TBonds = { 1994  -8.04,
           1995  23.48,
           1996   1.43,
           1997   9.94,
           1998  14.92,
           1999  -8.25,
           2000  16.66,
           2001   5.57,
           2002  15.12,
           2003   0.38,
           2004   4.49 };

proportion = 1 + TBonds[,2]/100; /* convert to proportion */
aveReturn = geomean( proportion );
print aveReturn;

Figure 24.145: Average Rate of Return for an Investment

aveReturn
1.0643334