harmonicMean: Harmonic Mean

harmonicMeanR Documentation

Harmonic Mean

Description

Functions to calculate the harmonic mean and weighted harmonic mean of a set of data.

Usage

hmean(x)

weighted.hmean(x, w)

Arguments

x

A numeric vector containing a set of observations.

w

A numeric vector containing the observation weights.

Details

The (weighted) harmonic mean of a data set is the inverse of the (weighted) mean of the inverse values. As such, any 0 value in the data (or in the non-zero weighted data in the weighted case) will result in the functions returning a value of 0. It is worth recall that whereas the value of the arithmetic mean is strongly influenced by even a few extreme values, the value of the harmonic mean is strongly influenced by even a few small values. The function take any numeric values. However, the harmonic mean of data containing both positive and negative values is unlikely to be stable.

Value

A numeric value.

Functions

  • hmean(): Harmonic Mean.

    Calculates the (unweighted) harmonic mean.

  • weighted.hmean(): Weighted Harmonic Mean

    Calculates the weighted harmonic mean.

Author(s)

Guillaume Guénard [aut, cre] (<https://orcid.org/0000-0003-0761-3072>), Pierre Legendre [ctb] (<https://orcid.org/0000-0002-3838-3305>)


guenardg/MPSEM documentation built on April 14, 2025, 3:53 p.m.