In a previous blog I posted the R functions to decompose Gini coefficients based on a weighted average of pseudo-Gini (Fei et al 1978; Shorrocks 1982). Another way to decompose inequality is a regression-based approach proposed by Morduch and Sicular (2002) following the logic of Shorrock's theorem in his classic 1982 paper.
decomp <- function(M) {
n <- length(M$coefficients)
cov <- cov(M$model[,1],M$model)
var <- cov[1]
cof <- M$coefficients
share <- cov[2:n]*cof[2:n]/cov[1]
decomp <- rbind(cov[2:n],cof[2:n],var,share)
rownames(decomp) <- c("covariance","coefficient",
"variance","contribution")
decomp
}
2. An example in R results:
1 comments:
情趣,情趣用品,
SM,G點,按摩棒,
跳蛋,按摩棒,
飛機杯,充氣娃娃,
自慰套,自慰套,
情趣娃娃,自慰器,
充氣娃娃,角色扮演,
潤滑液,跳蛋,
情趣禮物,情趣玩具,
威而柔,
自慰套,自慰器,充氣娃娃,
性感丁字褲,AV,按摩棒,電動按摩棒,情趣按摩棒,
潤滑液,SM,情趣內衣,內衣,性感內衣,
按摩棒,變頻跳蛋,跳蛋,無線跳蛋,G點,
Post a Comment