Announcement

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

  • The shape of concentration curves looks odds

    Dear all,

    I am trying to draw concentration curves to see whether there is health inequality among male and female. However, results look odds to me and different as compared to others' work.

    This is my dataset
    Code:
    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input float(disease pdis) byte ses_cat float sex
    1  0 1 0
    1  0 1 1
    1 12 2 1
    0  0 1 0
    1  4 1 0
    1  6 3 0
    1  3 1 0
    1  4 1 1
    1 10 1 1
    0  5 1 0
    1  6 2 0
    1  0 1 1
    1 11 1 0
    1  1 1 1
    1  8 5 1
    0  0 1 0
    1  4 2 1
    1  4 1 0
    1 10 4 0
    0  5 3 0
    1  0 2 1
    0  0 2 0
    1  1 1 0
    1  7 3 1
    1  0 1 1
    1  8 1 0
    1 12 . 0
    1  5 2 0
    1  4 1 0
    1  5 3 1
    0  0 1 1
    1  7 2 0
    0  1 2 0
    1  0 2 0
    1  0 2 1
    1  3 1 0
    1 12 . 1
    0  1 1 0
    1  0 1 0
    0  0 2 0
    0  1 1 0
    1  4 . 0
    1  6 1 0
    1  0 4 0
    1  5 1 0
    0  6 1 0
    0  0 1 1
    1  1 1 0
    1  7 1 1
    1  7 1 0
    1  4 1 1
    0 12 1 1
    1  5 1 1
    1  5 1 1
    1  0 1 0
    1  4 1 1
    1  8 1 0
    1  7 1 0
    1  9 1 0
    1 12 1 0
    1  7 1 0
    0  2 2 0
    1  1 1 0
    1 10 1 1
    1 12 1 1
    1  5 1 0
    1  8 1 1
    1 12 2 0
    1  3 1 0
    1  1 1 0
    1  7 3 1
    1  4 1 0
    1  3 3 0
    1  1 1 0
    0 11 3 0
    1  7 4 0
    1  3 1 0
    1  0 1 1
    0  0 1 1
    1  0 1 1
    1  3 1 1
    0  0 1 1
    0  0 5 0
    1  4 . 1
    1  5 2 0
    1  1 2 1
    1 10 1 0
    1  7 2 1
    1  7 1 1
    1  6 1 0
    1  0 1 1
    1  0 1 0
    1  0 2 0
    0  0 1 1
    0  0 1 0
    1  0 2 1
    0  0 2 1
    1 10 2 0
    1 12 1 1
    1 12 2 1
    end
    label values disease disease
    label def disease 0 "No diseases", modify
    label def disease 1 " At least 1 diseases", modify
    label values ses_cat ses_cat
    label def ses_cat 1 "Lowest", modify
    label def ses_cat 2 "2nd", modify
    label def ses_cat 3 "3rd", modify
    label def ses_cat 4 "4th", modify
    label def ses_cat 5 "Highest", modify
    label values sex sex
    label def sex 0 "Female", modify
    label def sex 1 "Male", modify
    ------------------ copy up to and including the previous line ------------------
    where disease is a binary variable computed by totaling 11 chronic diseases in which value 0 indicates no disease and 1 otherwise; sex (0-female and 1-male); ses_cat is household wealth computed by using principle component analysis, ranging from poorest to richest (five quintiles).

    Followings are my codes with disease variable:

    Code:
    glcurve disease, glvar(x) pvar(rank) sortvar(ses_cat) replace by(sex) split lorenz nograph
    ge rank2=rank
    label variable x_0 "conc curve Female"            
    lab var x_1 "conc curve Male"
    lab var rank "cumul share of disease (poorest first)"
    lab var rank2 "line of equality"
    
    twoway (line x_0 rank , sort clwidth(medthin) clpat(solid) clcolor(orange)) ///
        (line x_1 rank, sort clwidth(medthin) clpat(longdash) clcolor("153 204 0")) ///
        (line rank2 rank , sort clwidth(medthin) clcolor(gray)) ///
        , ytitle(cumulative share of disease, size(medsmall)) ///
        yscale(titlegap(5))  xtitle(, size(medsmall)) legend(rows(5)) xscale(titlegap(5)) ///
        legend(region(lwidth(none))) plotregion(margin(zero)) ysize(5.75) xsize(5) plotregion(lcolor(none))
        graph export "cc curves Male and Female.emf" , replace
    I do not know why the curves are not smooth as shown by other papers. I even try to use a continuous variable but it still did not get it right (pdis is disability variable measured in continuous). Any help is much appreciated.

    Best,

    DL


  • #2
    I appreciate your including data and code. It is often a good thing to simplify your code to the minimum needed to demonstrate the problem - all the titles and export and all just make it harder to see the core issues.

    I don't use glcurve. I ran it and saw the jumps you mention. With user written routines, a good answer depends on whether someone active on the Forum happens to use the routine. Your problem is in glcurve since twoway just graphs the variables. Can you try glcurve on some data for which you know the right outcome (from a text perhaps)? You could look for another routine that would serve your purpose. You can simplify the glcurve statement and then make it more complex. Or, if all else fails, you can ask the authors.

    Comment


    • #3
      Hi, I am new to the forum and stata itself. I need help in drawing a concentration curve. I am trying to graph prenatal care according to the wealth index. My prenatal care is a dichotomous variable ("yes/no") and after using the following code:


      glcurve prenatal_care [aw=weight], glvar(yord) pvar(rank) sortvar(wealth) lorenz



      I get a graph that is kinked and has jumps, instead of a smooth curve. Could someone please guide me on how to fix it. The data is from the DHS.

      Many thanks.

      I have also added the attatchment

      I have also attached the output of the graph
      Attached Files
      Last edited by Zahrah Rafique; 16 Jul 2019, 06:06.

      Comment


      • #4
        Originally posted by Zahrah Rafique View Post
        Hi, I am new to the forum and stata itself. I need help in drawing a concentration curve. I am trying to graph prenatal care according to the wealth index. My prenatal care is a dichotomous variable ("yes/no") and after using the following code:


        glcurve prenatal_care [aw=weight], glvar(yord) pvar(rank) sortvar(wealth) lorenz



        I get a graph that is kinked and has jumps, instead of a smooth curve. Could someone please guide me on how to fix it. The data is from the DHS.

        Many thanks.

        I have also added the attatchment

        I have also attached the output of the graph
        Hi Zahrah Rafique,

        I solved the concentration curve problem that I had. However, your case may be different as compared to mine so do you mind providing an example of your dataset using dataex command?

        Thank you!

        Cheers,

        Dung Le

        Comment


        • #5
          Hi,

          my problem has been solved. Many thanks.

          Comment


          • #6
            Can someone help me with concentration curve for the binary variable against wealth quintile.
            Thanks in advance

            Comment


            • #7
              Originally posted by Aashima Singhal View Post
              Can someone help me with concentration curve for the binary variable against wealth quintile.
              Thanks in advance
              Hi Aashima,

              To help people here understand your problems, do you mind providing a bit more information: an example of your dataset using dataex command, what commands did you use and how does the CC look like?

              Comment


              • #8
                I am working on government survey and was trying to check the occurrence of CHE (1 if occurred, 0 if not occurred) with respect to Quintiles ( my ranking variable).
                I wanted to make a concentration curve for the same i need the command as my variable is binary

                Comment


                • #9
                  Originally posted by Zahrah Rafique View Post
                  Hi, I am new to the forum and stata itself. I need help in drawing a concentration curve. I am trying to graph prenatal care according to the wealth index. My prenatal care is a dichotomous variable ("yes/no") and after using the following code:


                  glcurve prenatal_care [aw=weight], glvar(yord) pvar(rank) sortvar(wealth) lorenz



                  I get a graph that is kinked and has jumps, instead of a smooth curve. Could someone please guide me on how to fix it. The data is from the DHS.

                  Many thanks.

                  I have also added the attatchment

                  I have also attached the output of the graph
                  Hey i am also facing the same issue in wanting to plot the concentration curve for ANC of three years and then combining them. Can you tell me how to fix it.
                  here is my code
                  glcurve ANC_greater_or_4_2011 [aw= Sample_weight_2011 ], glvar(g1) pvar(p1) sortvar( Wealth_Index_2011 ) lorenz nograph
                  glcurve ANC_greater_or_4_2014 [aw= Sample_Weight_2014 ], glvar(g2) pvar(p2) sortvar( Wealth_index_2014 ) lorenz nograph
                  glcurve ANC_greater_or_4_2017 [aw= Sample_Weight_2017 ], glvar(g3) pvar(p3) sortvar( Wealth_index_2017 ) lorenz nograph

                  label variable g1 "g1"
                  label variable g2 "g2"
                  label variable g3 "g3"


                  graph twoway (line g1 p1, sort clwidth(medthin) clpat(longdash)) (line g2 p2, sort clwidth(medthin) clpat(longdash)) (line g3 p3, sort clwidth(medthin) clpat(longdash)) (function y=x, range(0 1) yaxis(1 2)), aspect(1) xtitle("cumulative proportion share, p") title("Lorenz curve comparison") ytitle("cumulative proportion wealth") legend(label(1 "outcome1") label(2 "outcom2") label (3 "outcome3"))
                  Graph.gph Click image for larger version

Name:	Graph.png
Views:	1
Size:	37.8 KB
ID:	1749170

                  Comment

                  Working...
                  X