Skip to contents

Computes the influence function for the Gini coefficient, useful for variance estimation in complex survey designs. The function implements the linearization approach described in Langel and Tillé (2013) .

Usage

if_gini(y, weights = NULL, na.rm = TRUE)

Arguments

y

Numeric vector of income or variable of interest.

weights

Numeric vector of sampling weights. If NULL (default), equal weights are assumed (simple random sampling).

na.rm

Logical. Should missing values be removed? Default is TRUE.

Value

A numeric vector of the same length as y containing the influence function values for each observation.

Details

The influence function for the Gini coefficient is computed using the linearization method, follwing Deville (1999) framework and as defined by Langel and Tillé (2013) . For observation \(k\) with value \(y_k\) and weight \(w_k\), the influence function is:

$$z_k = \frac{2W_k(y_k - \bar{Y}_k) + \hat{Y} - \hat{N}y_k - G(\hat{Y} + y_k\hat{N})}{\hat{N}\hat{Y}}$$

where:

  • \(W_k = \sum_{i=1}^k w_i\) is the cumulative sum of weights up to rank \(k\)

  • \(\bar{Y}_k =\frac{\sum_{l \in S} w_l y_l 1\left(W_l \leqslant W_j\right)}{W_k}\) is the weighted mean of values up to rank \(k\)

  • \(\hat{N} = \sum_i w_i\) is the total sum of weights

  • \(\hat{Y} = \sum_i w_i y_i\) is the weighted total of the variable

  • \(G\) is the Gini coefficient estimate

The observations are ranked by their values before computing the influence function.

References

Deville J (1999). “Variance estimation for complex statistics and estimators: linearization and residual techniques.” Survey methodology, 25, 193–204.

Langel M, Tillé Y (2013). “Variance estimation of the Gini index: revisiting a result several times published.” Journal of the Royal Statistical Society Series A, 176, 521–540.

See also

if_qsr for the quintile share ratio influence function and if_qri for the quantile ratio index influence function.

Other influence functions: if_qri(), if_qsr(), if_quantile()

Examples


data(synthouse)

eq <- synthouse$eq_income ### Income data

# Simple example
z <- if_gini(eq)

# With weights
w <- synthouse$weight
z_weighted <- if_gini(y = eq, weights = w)