一. 計算 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
優(yōu)點(diǎn):計算結(jié)果可直接調(diào)用
Syntax: by year provinceid: egen gini = inequal(incomeimp), index(gini)
index 括號中的內(nèi)容可以替換成以下不平等函數(shù):
-------------------------------------------------------------------------
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
用于計算不平等指數(shù),可按子樣本分解( by population subgroup )了牛∮セ觯可計算的不平等指數(shù)有:
- 單參數(shù)廣義熵類 GE(a),其中 a=-1粗井,0浇衬,1耘擂,2絮姆;
- Atkinson類 a(e)篙悯,其中 e=0.5,1螺捐,2 及其相關(guān)指數(shù):平均分配當(dāng)量收入 Yede(e)归粉、社會福利指數(shù) W(e)和 Sen 福利指數(shù)漏峰;
- 基尼系數(shù)浅乔;
- 百分位數(shù)比率 p90/p10 和 p75/p25,基于總樣本計算席噩,沒有分組數(shù)據(jù)。
優(yōu)點(diǎn):種類齊全埠忘;缺點(diǎn):結(jié)果較難調(diào)用
Syntax: ineqdeco varname [weight] [, bygroup(groupvar) w summ]
分解結(jié)果解讀:
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) 為泰爾指數(shù)旨怠, GE_W(1) 為組內(nèi)泰爾指數(shù)鉴腻,GE_B(1) 為組間泰爾指數(shù)百揭。
4 alorenz & glcurve
用于畫洛倫茲曲線
5 DASP:Distributive Analysis Stata Package
調(diào)用窗口: db ifgt
db difgt
更多命令自行在模塊中發(fā)掘
二. 分解
1 descogini
安裝來源:IDEAS
按收入來源分解(by source)信峻,可計算第 k 種來源變化1%對總體不平等的影響瓮床,沒有考慮權(quán)重
Syntax: descogini varlist [ if ] [ in ] [, d(#) bar]
varlist 第一個變量為總收入,不同來源收入可隨意排序
2 lerman
按收入來源和地區(qū)分解踢步,可考慮權(quán)重調(diào)整
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
分解基尼系數(shù)获印,基于 ineqdeco
命令街州,無法使用 sampling weight唆缴,且組內(nèi)差異計算似乎有bug
Syntax: ginidesc varname [[fweights aweights] if exp in range] ,bygroup(groupvar) [mat(matname) gkmat(matname)]
4 ineqdecgini
安裝來源:IDEAS
可按子樣本分解,且支持所有權(quán)重類型(大愛Jenkins T^T)
存儲的結(jié)果賊多艳丛,方便調(diào)用
美中不足的是 Within-groups component 是一個加總項(xiàng),沒有分組數(shù)據(jù)碰酝。
Jenkins 還提示可以配合使用 egen group
制造多維分組變量戴差,手感極佳暖释。
以上所有命令有錢人也可直接使用 ssc install ……
安裝。