View source: R/ci_generalized_mean.R
ci_generalized_mean | R Documentation |
Generalized means are a family of functions for aggregating sets of numbers (it include as special cases the Pythagorean means, arithmetic, geometric, and harmonic means). The generalized mean is also known as power mean or Holder mean.
ci_generalized_mean(x, indic_col, p, na.rm=TRUE)
x |
A data.frame containing simple indicators. |
indic_col |
Simple indicators column number. |
p |
Exponent |
na.rm |
Remove NA values before processing; default is TRUE. |
An object of class "CI". This is a list containing the following elements:
ci_generalized_mean_est |
Composite indicator estimated values. |
ci_method |
Method used; for this function ci_method="generalized_mean". |
The generalized mean with the exponent p
can be espressed as:
M_p(I_1,\dots,I_n) = \left( \frac{1}{n} \sum_{i=1}^n I_i^p \right)^{\frac{1}{p}}
Particular case are:
p=-\infty
: minimum, p=-1
: harmonic mean, p=0
: geometric mean,
p=1
: arithmetic mean, p=2
: root-mean-square and p=\infty
: maximum.
Vidoli F.
ci_geom_gen
, ci_factor
i1 <- seq(0.3, 0.5, len = 100) - rnorm (100, 0.2, 0.03)
i2 <- seq(0.3, 1, len = 100) - rnorm (100, 0.2, 0.03)
Indic = data.frame(i1, i2)
CI = ci_generalized_mean(Indic, p=-1) # harmonic mean
data(EU_NUTS1)
CI = ci_generalized_mean(EU_NUTS1,c(2:3),p=2) # geometric mean
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.