Announcement

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

  • Pen's Parade/ Paintdrip Chart

    Hi everyone,

    I am trying to create a Pen's parade or Paintdrip Chart in Stata for cumulative income minus a given household expenditure for each household. I have tried creating plotting cumulative frequency graphs for both variables with limited success and also the use of the 'alorenz' module. I have inserted a picture below of the kind of thing I would like to replicate with a different dataset. Any help is greatly appreciated as I'm a bit of a Stata novice.
    Click image for larger version

Name:	Screenshot 2021-02-23 at 17.45.37.png
Views:	1
Size:	38.7 KB
ID:	1594703


    Thanks, Nick

  • #2
    Code:
    help twoway_dropline
    should get you started.
    __________________________________________________ __
    Assistant Professor, Department of Biostatistics and Epidemiology
    School of Public Health and Health Sciences
    University of Massachusetts- Amherst

    Comment


    • #3
      Thanks Andrew,

      I've taken a look and it's the closest I've come to so far. The aim is to have a line falling from the ratio of income to poverty level pre-payment (POVLEV18) to the ratio of income to poverty level post-payment (NMPOVLEV18), and whether the line drops below 100 on the y-axis.

      cumul POVLEV18 if !missing(POVLEV18), gen(POVcum)
      twoway dropline NMPOVLEV18 POVcum

      An issue is I have 10,000 observations so even reducing the width of the dropline does not improve clarity. I've attached a picture of the result.

      Click image for larger version

Name:	Screenshot 2021-02-23 at 19.23.06.png
Views:	1
Size:	79.2 KB
ID:	1594722

      Comment


      • #4
        You will need to have three variables for a) ordering the individuals based on pre-OOP household consumption b) pre-OOP household consumption c) post-OOP household consumption
        The following code should then get you the desired results

        Code:
        sort pre_oop
        gen order = _n
        twoway line pre_oop order || line post_oop order,legend(pos(6)
        You will need to tweak a few options to get the exact graph that you want

        Comment


        • #5
          Originally posted by Tarun Choudhary View Post
          You will need to have three variables for a) ordering the individuals based on pre-OOP household consumption b) pre-OOP household consumption c) post-OOP household consumption
          The following code should then get you the desired results

          Code:
          sort pre_oop
          gen order = _n
          twoway line pre_oop order || line post_oop order,legend(pos(6)
          You will need to tweak a few options to get the exact graph that you want
          Hi Tarun,

          Thank you for your suggestion. I've applied your advice and it looks great.

          I've attached a picture, needs a little bit of fiddling but certainly what I was looking for!
          Thanks again.

          Click image for larger version

Name:	Screenshot 2021-02-24 at 13.05.43.png
Views:	1
Size:	63.7 KB
ID:	1594852

          Comment


          • #6
            Hi Nick Avis, do you mind to share me how you get into this graph? Currently trying to generate a similar graph in Indonesia's case. Thank you in advance.

            ps: I've tried using the above suggestion, but apparently there are several commands missing to get into your final graph.
            Last edited by Muhamad Farhan; 27 Feb 2023, 00:26. Reason: more clarity

            Comment


            • #7
              The advice in #4 seems sufficient to get the graph in #5 provided that one variable is always less than or equal to the variable you're ordering on. Otherwise here is some different technique in a self-contained script you can run.


              Code:
              clear 
              set obs 50 
              set seed 314159265
              
              gen y1 = exp(rnormal(0,1))
              gen y2 = y1 - exp(rnormal(0, 0.5))
              
              sort y1
              gen order = _n
              twoway rspike y1 y2 order, name(G1, replace)
              twoway rspike y1 y2 order || line y1 order , name(G2, replace)

              Comment

              Working...
              X