Title
anogi -- Analysis of Gini
Syntax
anogi varname [if] [in] [weight] , by(groupvar) [ detail nolabel fji oji vce(vcespec) ]
fweights, aweights, and pweights are allowed; see weight.
Description
anogi computes the "Analysis of Gini" for population subgroups proposed by Frick et al. (2006).
Requirements
anogi requires moremata. To install the package, type
. ssc describe moremata
Options
by(groupvar) defines the groups over which the Gini be decomposed. groupvar may be numeric or string.
detail displays detailed results for the subgroups.
fji causes the matrix of average between-group ranks to be displayed.
oji causes the matrix of between-group overlapping indices to be displayed.
nolabel causes the numeric codes of the groups to be displayed rather than the value labels.
vce(vcetype [, vceopts]) indicates that standard errors be estimated. vcetype is either bootstrap or jackknife. fweights and aweights are not allowed if vce() is specified.
The following vceopts are available:
strata(varname) specifies a variable that identifies strata. If this option is specified, bootstrap samples are taken independently within each stratum / stratified jackknife estimates are produced.
cluster(varname) specifies a variable that identifies sample clusters. If this option is specified, the sample drawn during each bootstrap replication is a sample of clusters / clusters are left out for jackknife estimation.
nodots suppresses display of the replication dots. By default, a single dot character is displayed for each successful replication. A single red 'x' is displayed, if a replication is not successful.
mse indicates that the variances be computed using deviations of the replicates from the estimate based on the entire dataset. By default, variances are computed using deviations from the average of the replicates.
Additional option for vce(jackknife):
fpc(varname) requests a finite population correction for the variance estimates. The values in varname are interpreted as stratum sampling rates. The values must be in [0,1] and are assumed to be constant within each stratum.
Additional option for vce(bootstrap):
reps(#) specifies the number of bootstrap replications to be performed. The default is 50. More replications are usually required to get reliable results. reps() is only allowed when vcetype is bootstrap.
Examples
. set obs 100 obs was 0, now 100
. generate x = invnormal(uniform())^2 . generate g = (x + uniform()) >= 1 . anogi x, by(g) Analysis of Gini
-------------------------------------------------- | Coef. % --------------------------+----------------------- Overall Gini | .6108943 100.00 | G_wo = sum s_i*G_i*O_i | .3548043 58.08 G_b | .25609 41.92 | IG = sum s_i*G_i | .4922952 80.59 IGO = sum s_i*G_i(O_i-1) | -.1374909 -22.51 BGp = G_bp | .3427792 56.11 BGO = G_b - G_bp | -.0866893 -14.19 --------------------------+----------------------- Mean of x | .7756576 N. of obs | 100 N. of subgroups | 2 --------------------------------------------------
. ret list
scalars: r(N) = 100 r(mean) = .7756576325441711 r(k) = 2
matrices: r(b) : 1 x 7 r(stats) : 2 x 7 . anogi x, by(g) vce(jack) Jackknife replications (100) ----+--- 1 ---+--- 2 ---+--- 3 ---+--- 4 ---+--- 5 .................................................. 50 .................................................. 100
Analysis of Gini
------------------------------------------------------------- | Coef. Std.Err. % --------------------------+---------------------------------- Overall Gini | .6108943 .0484469 100.00 | G_wo = sum s_i*G_i*O_i | .3548043 .0482766 58.08 G_b | .25609 .0443328 41.92 | IG = sum s_i*G_i | .4922952 .0567645 80.59 IGO = sum s_i*G_i(O_i-1) | -.1374909 .0316388 -22.51 BGp = G_bp | .3427792 .037861 56.11 BGO = G_b - G_bp | -.0866893 .0221666 -14.19 --------------------------+---------------------------------- Mean of x | .7756576 N. of obs | 100 N. of subgroups | 2 -------------------------------------------------------------
. eret list
scalars: e(N) = 100 e(df_r) = 99 e(mean) = .7756576325441711 e(k) = 2
macros: e(cmd) : "anogi" e(properties) : "b V"
matrices: e(b) : 1 x 7 e(V) : 7 x 7 e(stats) : 2 x 7 . test _b[BGO]=0
( 1) BGO = 0
F( 1, 99) = 15.29 Prob > F = 0.0002
Saved Results
See examples above. Results are returned in r(), unless vce() is specified, in which case results are returned in e(). b is a matrix containing the overall decomposition results. stats is a matrix containing the subgroup results. If fji is specified, F_ji contains the matrix of mean ranks. If oji is specified, O_ji contains the matrix of overlapping indices.
Methods and Formulas
The implementation deviates from the description in Frick et al. (2006) in that 1/n is used in the formula for the Gini instead of 1/(n-1).
References
Frick, J. R., Goebel, J., Schechtman, E., Wagner, G. G., Yitzhaki, S. (2006). Using Analysis of Gini (ANOGI) for Detecting Whether Two Subsamples Represent the Same Universe. The German Socio-Economic Panel Study (SOEP) Experience. Sociological Methods and Research 34:427-468.
Authors
Ben Jann, ETH Zurich, jann@soz.gess.ethz.ch
Tom Masterson, Levy Economics Institute of Bard College, masterso@levy.org
You may cite this software as follows:
Jann, B., and T. Masterson (2007). anogi: Stata module to generate Analysis of Gini. Available from http://ideas.repec.org/c/boc/bocode/s456730.html.
Also see
Online: moremata, mata mm_gini()