gini: Compute Gini coefficient

Description Usage Arguments Details Value Examples

View source: R/gini.R

Description

Compute the generalized Gini coefficient of the distribution of y with weights weights. The parameter v is the degree of risk aversion. By default, this parameter equals 2 which corresponds with the original Gini coefficient.

Usage

1
gini(y, weights = NULL, v = 2)

Arguments

y

numerical vector.

weights

numerical vector of the same length as y with weights for each observation.

v

numerical scalar, degree of inequality aversion. It should be non-negative.

Details

Observations with zero weights are discarded before the computations begin.

Value

A numeric scalar.

Examples

1
2
3
gini(1:5)
gini(1:5, weights = 5:1)
gini(1:5, weights = 5:1, v = 3)

jcpernias/ec1047 documentation built on Nov. 19, 2020, 2:33 a.m.