Language Reference

HARMEAN Function

calculates harmonic means

HARMEAN( matrix)

where matrix is a numeric matrix of nonnegative values.

The HARMEAN function returns a scalar containing the harmonic mean of the elements of the input matrix. The harmonic mean of a set of positive numbers a_1, a_2, ... ,a_n is n divided by the sum of the reciprocals of a_i. That is, n / \sum a_i^{-1}.

The harmonic mean is zero if any of the a_i are zero. The harmonic mean is not defined for negative inputs. If any of the a_i are missing, they are excluded from the computation.

The harmonic mean is sometimes used to compute an average sample size in an unbalanced experimental design. For example, the following statements compute an average sample size for five samples:

  
    sizes = { 8, 12, 23, 10, 8 }; /* sample sizes */ 
    aveSize = harmean( sizes ); 
    print aveSize; 
  
                                 aveSize 
  
                                 10.486322
 

Previous Page | Next Page | Top of Page