I have an interesting finding regards to twoway graph's legend option, put it precisely, it's about label option of legend. I use -lorenz- command (SSC) to estimate wage inequality between subgroups of union membership. I get a matrix named e(G) which stores gini indexes of union and nonunion groups. Then I use lorenz graph to get corresponding Gini curve. In the graph's legend options, I typed this code as "legend(ring(0) col(1) pos(11) label(1 `e(G)'[1,1]))". The resulting graph seems magical to me, because it demonstrate "Total (Gini=0.286) Nonunion (Gini=0.294) Union (Gini=0.246)" all at once, which I think I should designate by typing such as "label(1 "Total"`e(G)'[1,1]) label(2 "Nonunion"`e(G)'[2,1]) label(3 "Union"`e(G)'[3,1])". So, can anyone explain what's the principle behind this? Thank you very much.
Code:
. sysuse nlsw88
(NLSW, 1988 extract)
. lorenz estimate wage, over(union) total gini
L(p) Number of obs = 1,878
0: union = nonunion
1: union = union
--------------------------------------------------------------
wage | Coef. Std. Err. [95% Conf. Interval]
-------------+------------------------------------------------
0 |
0 | 0 (omitted)
5 | .0162309 .0005027 .0152449 .0172168
10 | .0368529 .0008292 .0352268 .0384791
15 | .0601058 .0011475 .0578554 .0623562
20 | .0863558 .001589 .0832394 .0894722
25 | .114934 .0018728 .111261 .118607
30 | .1457833 .0022658 .1413395 .150227
35 | .1796046 .0026487 .1744099 .1847994
40 | .2155412 .0029961 .209665 .2214173
45 | .2541379 .003311 .2476444 .2606315
50 | .2953025 .0036368 .2881699 .3024351
55 | .3392766 .0039191 .3315903 .3469629
60 | .3866722 .0041917 .3784513 .3948932
65 | .4377062 .0044134 .4290505 .4463618
70 | .4930304 .0046064 .4839963 .5020645
75 | .553573 .0047252 .5443058 .5628402
80 | .620733 .0047993 .6113205 .6301455
85 | .6939954 .0047797 .6846212 .7033696
90 | .7744107 .0045737 .7654407 .7833808
95 | .8675309 .0036053 .8604601 .8746016
100 | 1 . . .
-------------+------------------------------------------------
1 |
0 | 0 (omitted)
5 | .0182581 .0007901 .0167085 .0198078
10 | .0411449 .0014039 .0383914 .0438983
15 | .0672693 .0020022 .0633426 .0711961
20 | .0959286 .0026353 .0907601 .1010971
25 | .1278324 .003394 .121176 .1344888
30 | .1627902 .0040507 .1548458 .1707346
35 | .2003534 .0046264 .19128 .2094268
40 | .2402022 .0051768 .2300492 .2503552
45 | .2826347 .0056621 .2715301 .2937394
50 | .3279457 .0061731 .3158389 .3400525
55 | .3757295 .0066285 .3627295 .3887296
60 | .4269463 .0070685 .4130835 .4408092
65 | .4811007 .0074622 .4664657 .4957358
70 | .5380573 .0077973 .5227649 .5533496
75 | .597479 .0081124 .5815688 .6133893
80 | .6604931 .0082738 .6442663 .6767199
85 | .7274785 .008437 .7109317 .7440253
90 | .7992943 .0082971 .7830218 .8155668
95 | .8809539 .0075437 .866159 .8957488
100 | 1 . . .
-------------+------------------------------------------------
total |
0 | 0 (omitted)
5 | .0161147 .0004051 .0153202 .0169092
10 | .0367226 .0006934 .0353627 .0380826
15 | .0602741 .0010252 .0582634 .0622848
20 | .0868085 .0013371 .0841861 .0894308
25 | .1156008 .0016459 .1123728 .1188288
30 | .1472444 .0019984 .1433251 .1511636
35 | .1811803 .0022573 .1767531 .1856074
40 | .2178909 .0025612 .2128679 .222914
45 | .2572438 .0028595 .2516357 .2628519
50 | .299339 .003116 .2932277 .3054503
55 | .344591 .0033622 .337997 .351185
60 | .3931116 .0035971 .3860569 .4001662
65 | .4455101 .0037931 .438071 .4529493
70 | .5022412 .0039591 .4944765 .5100058
75 | .5640519 .0040864 .5560375 .5720663
80 | .6307203 .0041701 .6225418 .6388987
85 | .7026961 .004185 .6944883 .7109039
90 | .7810699 .0040762 .7730756 .7890643
95 | .8713064 .0033446 .8647468 .877866
100 | 1 . . .
--------------------------------------------------------------
-------------------------
| Gini
-------------+-----------
0 | .2943305
1 | .2462299
total | .2861153
-------------------------
. matrix list e(G)
e(G)[3,1]
Gini
0 .29433046
1 .24622995
total .28611525
. lorenz graph, keep(total 0 1) overlay noci legend(ring(0) col(1) pos(11) label(1 `e(G)'[1,1])) o1(lpattern(solid) lcolor(red%50)) o2(lpatter(longdash) lcolor(blue)) o3(lpattern(shortdash) lcolor(green)) yaxis(1 2)
0 Response to What's the principle behind twoway graph's legend and its label option
Post a Comment