Announcement

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

  • decile by decile graph

    Hey guys,

    I am looking for a way to plot income deciles on emission deciles. I have about 10.000 observations and created deciles as follows:

    Code:
    *make income deciles
    xtile net_income_month_dec = net_income_month, nq(10)
    
    *make deciles for emissions
    xtile e_md_dec = e_md, nq(10)
    If I now plot them using

    Code:
    scatter e_md_dec net_income_month_dec
    I get something that looks like a chess board, such that x,y = 1,1; 1,2; ...; 1,10. x,y = 2,1; 2,2; ...; 2,10 and so on and that is obviously not what I want.

    What I would like is a scatter in which every dot represents 1% of the population and which makes visible the different levels of dispersion in emission levels among the income deciles. I guess I took a wrong turn in thinking somewhere and I am thankful for another idea!

    Best,
    Julian
    Last edited by Julian Schaper; 01 Feb 2023, 07:05.

  • #2
    Your design is to me dubious as in practice many cells will contain (much) less than 1% of the total. You perhaps need some kind of bar chart or heat map.

    Comment


    • #3
      Dear Nick,

      I would like something like in the image below, only that I would like to have 10 points per decile instead of a boxplot.

      Click image for larger version

Name:	emissions_perdec.png
Views:	1
Size:	75.0 KB
ID:	1699980

      Comment


      • #4
        If you only want ten points per decile group of X, what are they to be e.g.

        1. 5(10)95 percent points of Y as the median of each decile group on Y

        2. Means of each decile group on Y for each decile on X.

        The second is going to be something like

        Code:
        egen toshow = mean(emd), by(e_md_dec net_income_month_dec)
        egen tag = tag(e_md_dec net_income_month_dec)
        scatter toshow net_income_dec if tag,  xla(1/10) ytitle("`: var label emd'")
        and the first just needs median() to be used, not mean().
        Last edited by Nick Cox; 02 Feb 2023, 06:59.

        Comment

        Working...
        X