hmean: Function to compute the harmonic mean of a numeric vector
Description
Computes the harmonic mean of a numeric vector. It is the inverse
of the mean of the recriprocals of n numbers, as follows.
$$y_h = \frac{n}{\left(\sum_{i=1}^{n} \frac{1}{y_i}\right)}$$
for \(y_i \neq 0\).
The harmonic mean can be used a central position statistics
of a random variable.
Usage
hmean(v)
Value
This function returns the harmonic mean, a numeric scalar.
Arguments
v
is a numeric vector
Author
Christian Salas-Eljatib.
Details
Notice that can only be computed for values different
from cero.
References
Salas-Eljatib, C. 2021. Análisis de datos con el programa
estadístico R: una introducción aplicada. Ediciones
Universidad Mayor, Santiago, Chile. 170 p.
https://eljatib.com/rlibro