ff_dist_gini_vector_pos: Compute gini coefficient between 0 (equality) and (n-1)/(n+1)...

Description Usage Arguments Value Author(s) References Examples

View source: R/ff_dist_gini.R

Description

See vignette for details, but very simple one line algorithm that computes gini for a pos or zero data vector. This does not work with negative values. Additionally, this is not for a sample, the vector is the population. Also note while the highest equality is 0, the greatest inequality only asymptotes to 1, but equals to (n-1)/(n+1).

Usage

1

Arguments

ar_pos

array of numeric values that are all non-negative

Value

a scalar value of the gini coefficient

Author(s)

Fan Wang, http://fanwangecon.github.io

References

https://fanwangecon.github.io/REconTools/reference/ff_dist_gini_vector_pos.html https://fanwangecon.github.io/REconTools/articles/fv_dist_gini_vector_pos.html https://github.com/FanWangEcon/REconTools/blob/master/R/ff_dist_gini.R

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
ar_equal_n2 = c(1,1)
ar_ineql_alittle_n2 = c(1,2)
ar_ineql_somewht_n2 = c(1,2^3)
ar_ineql_alotine_n2 = c(1,2^5)
ar_ineql_veryvry_n2 = c(1,2^8)
ar_ineql_mostmst_n2 = c(1,2^13)
# Beta draw testing
ar_beta_mostrich_n1000 = rbeta(1000, 5, 1)
ar_beta_mostpoor_n1000 = rbeta(1000, 1, 5)
ar_beta_manyrichmanypoor_nomiddle_n1000 = rbeta(1000, 0.5, 0.5)
ff_dist_gini_vector_pos(ar_equal_n2)
ff_dist_gini_vector_pos(ar_ineql_alittle_n2)
ff_dist_gini_vector_pos(ar_ineql_somewht_n2)
ff_dist_gini_vector_pos(ar_ineql_alotine_n2)
ff_dist_gini_vector_pos(ar_ineql_mostmst_n2)
ff_dist_gini_vector_pos(ar_beta_mostrich_n1000)
ff_dist_gini_vector_pos(ar_beta_mostpoor_n1000)
ff_dist_gini_vector_pos(ar_beta_manyrichmanypoor_nomiddle_n1000)

FanWangEcon/REconTools documentation built on Jan. 21, 2022, 10:28 p.m.