| Title: | Quantitative Methods for Political Economy |
|---|---|
| Description: | Computes weighted rank-dependent concentration and inequality indices with explicit treatment of tied ranks. Implements the relative, generalized, modified, Wagstaff-normalized and Erreygers-normalized estimators described by O'Donnell et al. (2016) <doi:10.1177/1536867X1601600112>. A replicate-weight survey design can estimate sampling uncertainty while recomputing fractional ranks for every replicate. This is an independently restructured R implementation informed by the 'Stata' command distributed under the GPL-3 license. |
| Authors: | Stefanos Stavrianos [aut, cre, cph], Owen O'Donnell [ctb, cph], Stephen O'Neill [ctb, cph], Tom Van Ourti [ctb, cph], Brendan Walsh [ctb, cph] |
| Maintainer: | Stefanos Stavrianos <[email protected]> |
| License: | GPL-3 |
| Version: | 0.1.0 |
| Built: | 2026-11-19 03:51:42 UTC |
| Source: | https://github.com/cran/polecon |
Compute relative, generalized, modified, Wagstaff and Erreygers
concentration indices with weighted mid-ranks. When rankvar is omitted,
the outcome is also the ranking variable and the result is a Gini-type index.
conindex(data, varname, rankvar = NULL, weight = NULL, truezero = TRUE, limits = NULL, generalized = FALSE, bounded = FALSE, wagstaff = FALSE, erreygers = FALSE, svy = NULL, na_action = c("omit", "fail"))conindex(data, varname, rankvar = NULL, weight = NULL, truezero = TRUE, limits = NULL, generalized = FALSE, bounded = FALSE, wagstaff = FALSE, erreygers = FALSE, svy = NULL, na_action = c("omit", "fail"))
data |
Data frame containing numeric variables. If |
varname |
Name of the numeric outcome variable. |
rankvar |
Optional name of numeric ranking variable, omitted for Gini. |
weight |
Optional weight column name or numeric vector. Omit with |
truezero |
If |
limits |
Theoretical limits of the outcome: length two when |
generalized |
Compute generalized index |
bounded |
Transform outcome to |
wagstaff |
Compute Wagstaff normalization of a bounded outcome. |
erreygers |
Compute Erreygers normalization of a bounded outcome. |
svy |
Optional |
na_action |
Drop invalid observations (default) or fail; with |
The weighted mid-rank for all observations tied at ranking value
is the sum of the weights strictly below , plus half the total weight
of the tie group, divided by the sum of all weights. With denoting
that rank and the weighted outcome mean, the standard index is
. Generalized is .
For the normalized bounded outcome , Erreygers is
and Wagstaff is
.
For a modified index with lower limit , use
.
With survey replicate weights, the point estimate is recomputed for each replicate; reported standard errors are design-dependent and use the replicate construction supplied by the analyst. Confidence intervals and p-values use a normal approximation. Without a replicate-weight survey design, this function does not estimate standard errors. Theoretical bounds must be meaningful for normalized indices; sample-based scaling alone does not imply substantive absolute outcome limits.
A conindex object containing CI, CIse,
p.value, N, Nunique, rank,
type, and concentration-curve coordinates in curve.
O'Donnell, O., O'Neill, S., Van Ourti, T. and Walsh, B. (2016). Conindex: Estimation of concentration indices. The Stata Journal, 16(1), 112–138. doi:10.1177/1536867X1601600112.
d <- data.frame(income = 1:4, outcome = c(1, 2, 3, 4), w = c(1, 1, 1, 1)) conindex(d, "outcome", "income", weight = "w") conindex(d, "outcome", weight = "w") b <- data.frame(income = 1:4, health = c(0, 0, 1, 1)) conindex(b, "health", "income", bounded = TRUE, limits = c(0, 1), erreygers = TRUE)d <- data.frame(income = 1:4, outcome = c(1, 2, 3, 4), w = c(1, 1, 1, 1)) conindex(d, "outcome", "income", weight = "w") conindex(d, "outcome", weight = "w") b <- data.frame(income = 1:4, health = c(0, 0, 1, 1)) conindex(b, "health", "income", bounded = TRUE, limits = c(0, 1), erreygers = TRUE)
Print an index, extract a one-row data frame, or obtain an approximate confidence interval if a replicate-weight standard error is available.
conindex_results(x) ## S3 method for class 'conindex' print(x, ...) ## S3 method for class 'conindex' confint(object, parm = NULL, level = 0.95, ...)conindex_results(x) ## S3 method for class 'conindex' print(x, ...) ## S3 method for class 'conindex' confint(object, parm = NULL, level = 0.95, ...)
x |
Object of class |
object |
Object of class |
parm |
Must be |
level |
Confidence level between zero and one. |
... |
Unused extra arguments for generic-method compatibility. |
conindex_results gives a one-row data frame;
print returns the input invisibly; confint returns
an interval matrix.
d <- data.frame(y = 1:4) z <- conindex(d, "y") conindex_results(z)d <- data.frame(y = 1:4) z <- conindex(d, "y") conindex_results(z)