Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to combine seven individual concentration curve lines in one graph by conindex?

    Hello
    I am producing concentration curves by using conindex in Stata for seven different datasets individually. The code is attached below:

    Here
    y=response (binary outcome), index_variable=inequalities variable

    Code:
    conindex y [aweight= wgt ], rankvar(index_variable ) truezero wagstaff bounded limits(0 1) cluster(cluster_variable) graph ytitle(Cumulative share of y) xtitle(Rank of index_variable)


    For seven distinct datasets, the command provides seven graphs. Graphs are attached below. Now I want to produce seven concentration curve lines into one graph. Could anyone please help me to meet my purpose?

    I have appended the analysis command above, if not possible by conindex, then please guide me the consistent way to produce seven concentration curve lines in one graph.

    Thank you in advance.

    output:
    Dataset1
    Click image for larger version

Name:	dataset1.png
Views:	1
Size:	11.0 KB
ID:	1647389
    Dataset2
    Click image for larger version

Name:	dataset2.png
Views:	1
Size:	26.0 KB
ID:	1647391
    Dataset3
    Click image for larger version

Name:	dataset3.png
Views:	1
Size:	28.1 KB
ID:	1647392


    Dataset4
    Click image for larger version

Name:	dataset4.png
Views:	1
Size:	27.5 KB
ID:	1647393


    Dataset5 (not attached)

    Dataset6 (not attached)

    Dataset7 (not attached)



    Purpose to combine seven concentration curve lines into one graph in the following way (please give necessary guideline to produce the graph)

    Click image for larger version

Name:	sample graph.PNG
Views:	1
Size:	36.2 KB
ID:	1647390

  • #2
    Hi Nusrat,

    If you want to use conindex (from SSC) to make CCs, you may want to read this post (look for #7): https://www.statalist.org/forums/for...lable-from-ssc
    Alternatively, you can compute rank and other estimates manually and then use twoway command to make CCs. For more detail, look for Figure 7.1, pages 86-87, Chapter 7. Authors of the book provided code examples there, but you need to modify the code based on your own data. I think the first step is that you need to pool the seven datasets together (if you haven't done this step) and then follow code in the above-mentioned book.

    Book: https://openknowledge.worldbank.org/...=1&isAllowed=y

    In case, you need more help, please use dataex command to provide your data example in the next post.

    Comment


    • #3
      Hi Dung Le

      Thank you very much for your response. I have already pooled the seven datasets and previously introduced with the manual method and twoway command to make CCs. But I want to use conindex for making CCs. I am going through https://www.statalist.org/forums/for...lable-from-ssc

      In my directory,, all packages along with conindex are installed in c:\ado\plus\. From there, I have edited conindex ado file on 352 number lines by typing the below command:
      gen y_`varlist'=`cumlhs1'

      * Run the first concentration curve
      conindex Y1, truezero rankvar(rank) graph keep(ranked1)
      * Run the second concentration curve
      conindex Y2, truezero rankvar(rank) graph keep(ranked2)


      Above two commands execute properly.

      * Now make your combined concentration curve graph:
      twoway (line y_Y1 ranked1, sort clwidth(thick) clcolor(blue))(line y_Y2 ranked2, sort clwidth(thick) clcolor(blue)), ytitle(`ytitle', size(medsmall)) yscale(titlegap(5)) xtitle(`xtitle', size(medsmall)) legend(rows(5)) xscale(titlegap(5)) legend(off) plotregion(margin(zero) lcolor(none)) aspect(1) ysize(8) xsize(8) graphregion(color(white)) bgcolor(white)


      But in the above command, I have found error that variable y_Y1 not found.

      I maybe missed something to edit conindex ado file. Could you please help me to fix the error?

      Besides, I do not find site, personal, and oldplace file in my directory.
      SITE: G:\Stata1332\ado\site\
      PERSONAL: c:\ado\personal\
      OLDPLACE: c:\ado\

      Comment


      • #4
        Hi Nusrat,

        If you have correctly done what the author of conindex command suggested, but did not work. The possible reason could be that authors of that command updated conindex ado file, so the correct line number was changed (not 352 line numbers anymore). If that is the case, then I don't have any ideas on how to fix it. You can send an email him and ask him about this.

        However, as I suggested in #2, you can generate y_Y1 manually and then use twoway command to make CCs.

        Hope this helps.

        Comment


        • #5
          Hi Dung

          I am thankful to you for your feedback. I really appreciate your help.

          Comment

          Working...
          X