Learn R Programming

Compind (version 2.0)

ci_generalized_mean: Weighting method based on generalized mean

Description

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.

Usage

ci_generalized_mean(x, indic_col, p, na.rm=TRUE)

Arguments

x

A data.frame containing simple indicators.

indic_col

Simple indicators column number.

p

Exponent \(p\) (real number).

na.rm

Remove NA values before processing; default is TRUE.

Value

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".

See Also

ci_geom_gen, ci_factor

Examples

Run this code
# NOT RUN {
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
# }

Run the code above in your browser using DataLab