一. 计算 Gini/Theil/Percentile ratios
1 egen inequal
用于计算 relative mean deviation, coefficient of variation, standard
deviation of logs, Gini index, Mehran index, Piesch index, Kakwani index,
Theil entropy index, and mean log deviation
优点:计算结果可直接调用
Syntax: by year provinceid: egen gini = inequal(incomeimp), index(gini)
index 括号中的内容可以替换成以下不平等函数:
-------------------------------------------------------------------------
code function
rmd the relative mean deviation
cov the coefficient of variation
sdl the standard deviation of logs
gini the Gini index
mehran the Mehran index
piesch the Piesch index
kakwani the Kakwani index
theil Theil entropy index
mld the mean log deviation
entropy generalized entropy measure (GE -1)
half generalized entropy measure (GE 2)
-------------------------------------------------------------------------
2 inequal
用于计算 the Atkinson inequality index, Lorenz curve, the Donaldson-Weymark relative S-Gini
Syntax:
inequal varname [if exp] [in range] [fweights]
atkinson varname [if exp] [in range] [fweights] [, epsilon(#[,#[,...]]) ]
lorenz varname [if exp] [in range] [fweights] [, offset graph-options ]
relsgini varname [if exp] [in range] [fweights] [, delta(#[,#[,...]]) ]
3 ineqdeco
用于计算不平等指数,可按子样本分解( by population subgroup )。可计算的不平等指数有:
- 单参数广义熵类 GE(a),其中 a=-1,0,1,2;
- Atkinson类 a(e),其中 e=0.5,1,2 及其相关指数:平均分配当量收入 Yede(e)、社会福利指数 W(e)和 Sen 福利指数;
- 基尼系数;
- 百分位数比率 p90/p10 和 p75/p25,基于总样本计算,没有分组数据。
优点:种类齐全;缺点:结果较难调用
Syntax: ineqdeco varname [weight] [, bygroup(groupvar) w summ]
分解结果解读:
GE(a) = GE_W(a) + GE_B(a)
where GE_W(a) is Within-group Inequality and GE_B(a) is Between-Group
Inequality.
比如,GE(1) 为泰尔指数, GE_W(1) 为组内泰尔指数,GE_B(1) 为组间泰尔指数。
4 alorenz & glcurve
用于画洛伦兹曲线
5 DASP:Distributive Analysis Stata Package
调用窗口: db ifgt
db difgt
更多命令自行在模块中发掘
二. 分解
1 descogini
安装来源:IDEAS
按收入来源分解(by source),可计算第 k 种来源变化1%对总体不平等的影响,没有考虑权重
Syntax: descogini varlist [ if ] [ in ] [, d(#) bar]
varlist 第一个变量为总收入,不同来源收入可随意排序
2 lerman
按收入来源和地区分解,可考虑权重调整
Syntax: lerman country year varlist [if] [in] [pw=weight]
country = a string variable that includes one or more geographic units (countries, states, divisions, etc).
year = a numeric variable that includes one or more time units
varlist = total income followed by its components
3 ginidesc
安装来源:IDEAS
分解基尼系数,基于 ineqdeco
命令,无法使用 sampling weight,且组内差异计算似乎有bug
Syntax: ginidesc varname [[fweights aweights] if exp in range] ,bygroup(groupvar) [mat(matname) gkmat(matname)]
4 ineqdecgini
安装来源:IDEAS
可按子样本分解,且支持所有权重类型(大爱Jenkins T^T)
存储的结果贼多,方便调用
美中不足的是 Within-groups component 是一个加总项,没有分组数据。
Jenkins 还提示可以配合使用 egen group
制造多维分组变量,手感极佳。
以上所有命令有钱人也可直接使用 ssc install ……
安装。