harmonicMean | R Documentation |
Functions to calculate the harmonic mean and weighted harmonic mean of a set of data.
hmean(x)
weighted.hmean(x, w)
x |
A numeric vector containing a set of observations. |
w |
A numeric vector containing the observation weights. |
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.
A numeric value.
hmean()
: Harmonic Mean.
Calculates the (unweighted) harmonic mean.
weighted.hmean()
: Weighted Harmonic Mean
Calculates the weighted harmonic mean.
Guillaume Guénard [aut, cre] (<https://orcid.org/0000-0003-0761-3072>), Pierre Legendre [ctb] (<https://orcid.org/0000-0002-3838-3305>)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.