hmean {datana} | R Documentation |
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)
Arguments
v |
is a numeric vector |
Details
Notice that can only be computed for values different from cero.
Value
This function returns the harmonic mean, a numeric scalar.
Author(s)
Christian Salas-Eljatib.
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
Examples
y.var <- runif(10, min=10, max=45)
hmean(y.var)
[Package datana version 1.1.1 Index]