Announcement

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

  • coefplot y-axis labels

    Dear users I am using Stata 18.5 and trying to plot O-B decomposition results using coefplot

    Code:
    oaxaca outcome (X1: q_mpce_d2 q_mpce_d3 q_mpce_d4 q_mpce_d5)                        ///
    (X2:head_edu_d2 head_edu_d3 head_edu_d4)                                                ///
    (X3: caste3_d2 caste3_d3) (X4: nssregn_d2 nssregn_d3 nssregn_d4 nssregn_d5 nssregn_d6)    ///
    (X5: sex_hh_d1) (X6: religon_d1 religon_d3) (X7: age_hh)                        ///
    (X8: size_hh_d1 size_hh_d2) [iw=wt], by(residence_d2) omega ro
    
    est sto m1

    After applying oaxaca-blinder decomposition, I am trying to plot the results using coefplot command

    Code:
    coefplot (m1, label(Outcome Variable)), drop(overall:group*) xline(0)                                                               ///
    recast(bar) barwidth(.35) base(0) citop ciopts(recast(rcap))                                                                      ///
    xtitle("Percent", size(small)) xlabel(-.10 "-10" 0 "0" .10 "10" .20 "20" .30 "30" .40 "40" .50 "50" .60 "60")                    ///
    mlabel format(%9.2g) mlabposition(3) mlabsize(tiny) mlabgap(*3) grid(n)                                                        ///
    legend(position(3) ring(0)) scheme(cleanplots)                                                                                 ///
    ylab(1 "Difference" 2 "Explained" 3 "Unxplained"                                                                              /// 1-3 main    
    5 "X1" 6 "X2" 7 "X3" 8 "X4" 9 "X5" 10 "X6" 11 "X7"    12 "X8"                                                                  /// 5-12, factors explained
     14 "X1" 15 "X2" 16 "X3" 17 "X4" 18 "X5" 19 "X6" 20 "X7" 21 "X8"                                                                       /// 14-22, factors unexplained
      22 "Constant", labsize(vsmall))
    The outcome of the above command is shown in the figure attached here.


    My query is:

    How to manage the second (outer) part of the y-axis in the graph, i.e., how to align left, add labels, and rotate its angle?

    Thank you!!
    Click image for larger version

Name:	Graph.png
Views:	1
Size:	73.7 KB
ID:	1767394

    Last edited by Mukesh Punia; 11 Nov 2024, 05:23.
    Best regards,
    Mukesh

  • #2
    Ben Jann
    Best regards,
    Mukesh

    Comment


    • #3
      Use suboptions within option eqlabels() to affect the rendering of outer labels. Aligning the labels on the left is difficult, see https://repec.sowi.unibe.ch/stata/co...lling.html#h-7

      Comment


      • #4
        thank you, respected Ben Jann, for your response. It worked.

        I have two specific queries-

        1. Is there a way to "hide or drop outer labels"?
        2. I want to combine two graphs/coefplots. Both have the same y-labels but different outcome/dependent variables, so I want to keep y-labels from only one. As shown in the figure attached in post#1. As of now, I did it with gr_edit
        Best regards,
        Mukesh

        Comment


        • #5
          Dear Andrew Musau Ben Jann can you please explain how to plot only explained part (drop unexplained part) in post #1.
          Best regards,
          Mukesh

          Comment


          • #6
            I think if you just change your drop option to
            Code:
            drop(overall:group* unexplained:*)
            you should get what you need.

            Also, three suggestions for the future:
            • Please do provide a data example with your question, so we can reproduce what you are doing.
            • When using a community-contributed command, please mention its source so that others know how to obtain it. In this case, oaxaca is available from net install oaxaca.pkg and coefplot is available from the Stata Journal.
            • In my experience, addressing your post to specific individuals is as likely to reduce the chances of getting an answer (since others are less likely to want to answer) as increase them (from the addressees being drawn to the post). Addressing it to specific individuals can also feel burdensome to them. It may be best to avoid this.
            Last edited by Hemanshu Kumar; 17 Apr 2025, 00:26.

            Comment


            • #7

              Dear Hemanshu Kumar , thank you for quick and very useful help and guidelines for a better response.

              *Posting with example data:

              I have two final small queries:
              1) Is there a way to remove the y-axis outer labels (overall, explained, and unexplained)? Currently, I use gr_edit
              2) How to convert explained proportion label into a percent (%), e.g in difference (.44), be shown like 44% or 44. I am using STATA 18

              Thank you!
              Code:
              clear
              input float outcome byte(r_d1 r_d2 ca_d1 ca_d2 ca_d3 q_d1 q_d2 q_d3 q_d4 q_d5) float age
              1 1 0 0 0 1 0 0 0 0 1 51
              1 1 0 0 1 0 1 0 0 0 0 52
              1 1 0 0 1 0 0 0 0 0 1 35
              1 1 0 1 0 0 1 0 0 0 0 38
              1 1 0 0 1 0 0 0 0 0 1 56
              1 1 0 0 1 0 0 0 0 0 1 55
              1 1 0 0 0 1 0 0 0 0 1 65
              0 1 0 0 1 0 0 1 0 0 0 58
              1 1 0 0 0 1 0 0 0 0 1 21
              1 1 0 0 1 0 0 0 0 1 0 62
              1 1 0 0 0 1 0 0 0 1 0 38
              1 1 0 1 0 0 0 0 0 0 1 46
              1 1 0 1 0 0 0 0 0 1 0 72
              1 1 0 0 1 0 0 0 0 0 1 32
              1 1 0 0 0 1 0 0 0 0 1 65
              1 1 0 0 1 0 0 0 0 1 0 70
              1 1 0 0 0 1 0 0 1 0 0 50
              1 1 0 0 1 0 0 0 0 0 1 55
              1 1 0 0 1 0 0 0 0 1 0 52
              1 1 0 1 0 0 0 0 0 0 1 37
              1 1 0 0 1 0 0 0 0 0 1 51
              1 1 0 1 0 0 0 0 0 1 0 80
              1 1 0 0 1 0 0 0 1 0 0 80
              1 1 0 0 1 0 0 0 1 0 0 38
              0 1 0 0 1 0 0 0 0 1 0 50
              1 1 0 0 1 0 0 0 0 1 0 73
              1 1 0 0 0 1 0 0 0 0 1 41
              1 1 0 1 0 0 0 1 0 0 0 30
              1 1 0 0 0 1 0 0 0 0 1 40
              1 1 0 1 0 0 0 0 0 1 0 29
              1 1 0 0 0 1 0 0 0 0 1 52
              1 1 0 0 1 0 0 0 0 0 1 52
              0 1 0 0 1 0 0 0 0 0 1 58
              1 1 0 0 0 1 0 0 0 1 0 59
              1 1 0 0 0 1 0 0 0 0 1 50
              1 1 0 0 0 1 0 0 0 1 0 50
              1 1 0 0 0 1 0 0 0 0 1 19
              1 1 0 1 0 0 0 0 0 1 0 39
              1 1 0 0 1 0 0 0 1 0 0 68
              1 1 0 1 0 0 0 0 0 0 1 63
              1 1 0 0 1 0 0 0 0 0 1 39
              0 1 0 0 1 0 1 0 0 0 0 40
              1 1 0 0 1 0 0 0 0 1 0 68
              1 1 0 0 0 1 0 0 0 1 0 36
              1 1 0 0 1 0 0 0 0 1 0 56
              0 1 0 0 0 1 0 0 0 0 1 47
              1 1 0 0 0 1 0 0 0 0 1 40
              1 1 0 1 0 0 0 0 0 1 0 38
              1 1 0 0 1 0 0 0 0 0 1 35
              1 1 0 0 0 1 0 0 0 0 1 40
              1 1 0 0 0 1 0 0 0 0 1 76
              1 1 0 0 1 0 0 0 0 0 1 55
              1 1 0 0 1 0 0 0 0 0 1 39
              1 1 0 0 0 1 0 0 0 0 1 70
              1 1 0 1 0 0 0 0 0 1 0 22
              1 1 0 0 0 1 0 0 1 0 0 70
              1 1 0 0 1 0 0 1 0 0 0 55
              1 1 0 0 1 0 0 0 0 1 0 62
              0 1 0 1 0 0 1 0 0 0 0 60
              1 1 0 0 0 1 0 0 0 0 1 38
              1 1 0 1 0 0 0 0 0 0 1 50
              1 1 0 0 1 0 0 0 0 0 1 44
              0 1 0 1 0 0 0 1 0 0 0 61
              1 1 0 0 0 1 0 0 0 0 1 68
              1 1 0 0 0 1 1 0 0 0 0 40
              1 1 0 1 0 0 0 0 1 0 0 35
              1 1 0 0 1 0 0 0 1 0 0 66
              1 1 0 0 1 0 0 1 0 0 0 58
              1 1 0 0 0 1 0 0 0 0 1 52
              1 1 0 1 0 0 0 0 0 0 1 40
              1 1 0 0 1 0 0 1 0 0 0 69
              1 1 0 1 0 0 0 0 0 1 0 47
              1 1 0 0 1 0 0 0 0 1 0 40
              1 1 0 0 1 0 0 0 0 0 1 51
              1 1 0 1 0 0 0 0 0 1 0 42
              1 1 0 0 1 0 0 0 0 1 0 39
              1 1 0 1 0 0 0 0 0 1 0 72
              1 1 0 0 0 1 0 0 0 1 0 79
              1 1 0 0 1 0 0 0 0 0 1 48
              1 1 0 1 0 0 0 1 0 0 0 52
              1 1 0 0 1 0 0 0 0 1 0 55
              1 1 0 0 1 0 0 0 0 1 0 42
              1 1 0 0 0 1 0 0 0 0 1 54
              1 1 0 1 0 0 0 0 0 0 1 43
              1 1 0 0 1 0 0 0 0 1 0 56
              1 1 0 0 0 1 0 0 0 0 1 65
              1 1 0 0 0 1 0 0 0 1 0 35
              1 1 0 0 1 0 0 1 0 0 0 65
              1 1 0 0 1 0 0 0 0 0 1 72
              1 1 0 1 0 0 0 0 0 1 0 37
              1 1 0 0 0 1 0 0 0 0 1 70
              1 1 0 0 0 1 0 0 0 0 1 71
              1 1 0 0 1 0 0 0 0 0 1 38
              1 1 0 0 1 0 0 0 0 0 1 38
              1 1 0 0 1 0 0 0 0 1 0 42
              1 1 0 1 0 0 0 0 0 0 1 65
              0 1 0 0 1 0 1 0 0 0 0 48
              1 1 0 0 0 1 0 0 0 0 1 56
              0 1 0 0 0 1 0 0 1 0 0 35
              1 1 0 0 1 0 0 0 0 0 1 33
              1 1 0 0 1 0 0 1 0 0 0 46
              1 1 0 1 0 0 0 0 0 0 1 42
              1 1 0 0 1 0 0 0 0 0 1 36
              1 1 0 0 0 1 0 0 0 0 1 40
              1 1 0 0 1 0 0 0 0 1 0 74
              1 1 0 0 1 0 0 1 0 0 0 35
              1 1 0 0 1 0 0 0 0 1 0 56
              1 1 0 1 0 0 0 0 0 1 0 68
              1 1 0 1 0 0 0 0 0 1 0 58
              1 1 0 0 1 0 0 0 0 1 0 38
              1 1 0 0 0 1 0 0 0 1 0 50
              1 1 0 0 0 1 0 0 0 0 1 41
              0 0 1 0 1 0 0 0 1 0 0 28
              1 0 1 0 0 1 0 0 1 0 0 30
              0 0 1 0 1 0 0 1 0 0 0 44
              1 0 1 0 1 0 0 0 0 0 1 30
              0 0 1 0 0 1 0 0 1 0 0 80
              0 0 1 1 0 0 0 1 0 0 0 51
              0 0 1 0 1 0 0 1 0 0 0 44
              0 0 1 0 1 0 1 0 0 0 0 45
              0 0 1 1 0 0 0 1 0 0 0 60
              1 0 1 1 0 0 0 0 1 0 0 55
              0 0 1 1 0 0 0 0 0 1 0 35
              1 0 1 1 0 0 1 0 0 0 0 45
              0 0 1 1 0 0 1 0 0 0 0 45
              0 0 1 0 1 0 1 0 0 0 0 41
              1 0 1 1 0 0 0 0 0 0 1 62
              0 0 1 0 1 0 0 0 0 0 1 45
              1 0 1 0 0 1 0 0 1 0 0 65
              0 0 1 1 0 0 1 0 0 0 0 48
              1 0 1 0 0 1 0 0 0 1 0 36
              0 0 1 0 1 0 0 0 1 0 0 30
              1 0 1 0 1 0 0 0 0 0 1 62
              0 0 1 1 0 0 1 0 0 0 0 45
              1 0 1 0 1 0 0 0 1 0 0 40
              1 0 1 0 1 0 0 0 1 0 0 52
              1 0 1 0 0 1 1 0 0 0 0 48
              1 0 1 1 0 0 0 0 0 0 1 62
              0 0 1 0 1 0 0 0 1 0 0 62
              1 0 1 0 1 0 0 1 0 0 0 65
              0 0 1 1 0 0 0 0 1 0 0 34
              0 0 1 0 1 0 1 0 0 0 0 43
              0 0 1 1 0 0 0 1 0 0 0 65
              0 0 1 1 0 0 1 0 0 0 0 32
              1 0 1 1 0 0 1 0 0 0 0 55
              0 0 1 1 0 0 0 0 1 0 0 26
              1 0 1 1 0 0 1 0 0 0 0 75
              1 0 1 0 0 1 0 0 0 0 1 47
              0 0 1 0 0 1 1 0 0 0 0 52
              1 0 1 1 0 0 0 0 1 0 0 62
              0 0 1 1 0 0 1 0 0 0 0 48
              1 0 1 1 0 0 0 0 1 0 0 30
              1 0 1 1 0 0 1 0 0 0 0 35
              1 0 1 0 1 0 0 1 0 0 0 34
              0 0 1 0 1 0 0 1 0 0 0 60
              1 0 1 1 0 0 0 1 0 0 0 40
              1 0 1 0 1 0 0 1 0 0 0 55
              0 0 1 0 0 1 0 1 0 0 0 53
              1 0 1 1 0 0 0 0 1 0 0 60
              1 0 1 0 1 0 0 0 0 1 0 50
              0 0 1 1 0 0 0 1 0 0 0 27
              1 0 1 1 0 0 0 0 1 0 0 85
              0 0 1 0 1 0 1 0 0 0 0 28
              0 0 1 1 0 0 0 1 0 0 0 70
              1 0 1 0 0 1 0 0 0 1 0 49
              1 0 1 0 0 1 1 0 0 0 0 46
              0 0 1 0 1 0 0 0 0 1 0 73
              0 0 1 0 1 0 0 1 0 0 0 43
              0 0 1 0 1 0 0 0 1 0 0 47
              1 0 1 0 0 1 0 0 0 0 1 78
              1 0 1 0 1 0 0 0 1 0 0 58
              1 0 1 0 1 0 0 1 0 0 0 65
              1 0 1 0 1 0 0 1 0 0 0 80
              0 0 1 0 1 0 0 0 0 1 0 65
              0 0 1 0 1 0 0 0 1 0 0 50
              0 0 1 1 0 0 0 0 0 0 1 25
              1 0 1 1 0 0 1 0 0 0 0 34
              1 0 1 0 1 0 0 0 1 0 0 70
              0 0 1 0 0 1 0 0 1 0 0 45
              0 0 1 1 0 0 1 0 0 0 0 55
              1 0 1 1 0 0 1 0 0 0 0 76
              1 0 1 0 1 0 0 0 1 0 0 54
              0 0 1 1 0 0 0 1 0 0 0 66
              0 0 1 1 0 0 0 1 0 0 0 33
              0 0 1 1 0 0 0 1 0 0 0 53
              1 0 1 0 0 1 0 1 0 0 0 45
              0 0 1 1 0 0 0 1 0 0 0 39
              0 0 1 0 0 1 0 0 1 0 0 48
              0 0 1 0 1 0 0 1 0 0 0 50
              0 0 1 1 0 0 1 0 0 0 0 40
              1 0 1 1 0 0 0 0 1 0 0 47
              0 0 1 0 1 0 0 0 1 0 0 49
              0 0 1 0 1 0 1 0 0 0 0 52
              0 0 1 1 0 0 0 0 0 1 0 50
              1 0 1 0 0 1 0 0 0 1 0 55
              0 0 1 0 1 0 1 0 0 0 0 62
              1 0 1 0 1 0 0 0 0 1 0 75
              0 0 1 0 0 1 1 0 0 0 0 35
              0 0 1 1 0 0 0 1 0 0 0 45
              0 0 1 0 0 1 0 0 1 0 0 75
              0 0 1 0 1 0 1 0 0 0 0 32
              1 0 1 0 0 1 0 0 0 1 0 35
              1 0 1 1 0 0 1 0 0 0 0 75
              1 0 1 0 0 1 0 0 0 0 1 47
              1 0 1 0 0 1 0 0 0 1 0 45
              0 0 1 0 1 0 0 0 1 0 0 45
              1 0 1 0 1 0 0 0 0 1 0 33
              1 0 1 1 0 0 0 0 0 1 0 55
              1 0 1 0 0 1 0 0 0 0 1 02
              0 0 1 1 0 0 1 0 0 0 0 63
              0 0 1 0 1 0 1 0 0 0 0 32
              0 0 1 1 0 0 1 0 0 0 0 36
              0 0 1 0 0 1 0 0 0 0 1 50
              1 0 1 0 1 0 0 0 0 0 1 47
              0 0 1 0 1 0 0 0 0 1 0 50
              0 0 1 1 0 0 1 0 0 0 0 51
              0 0 1 1 0 0 0 0 1 0 0 32
              1 0 1 0 1 0 1 0 0 0 0 53
              0 0 1 1 0 0 0 1 0 0 0 45
              0 0 1 1 0 0 1 0 0 0 0 24
              1 0 1 0 1 0 0 0 0 0 1 42
              1 0 1 0 1 0 0 1 0 0 0 39
              0 0 1 1 0 0 1 0 0 0 0 50
              0 0 1 0 1 0 0 0 1 0 0 27
              1 0 1 1 0 0 0 0 0 1 0 62
              0 0 1 1 0 0 0 0 1 0 0 48
              1 0 1 0 1 0 1 0 0 0 0 48
              0 0 1 1 0 0 0 0 1 0 0 71
              1 0 1 1 0 0 1 0 0 0 0 80
              1 0 1 0 1 0 0 1 0 0 0 60
              0 0 1 0 1 0 0 0 0 1 0 64
              1 0 1 1 0 0 1 0 0 0 0 50
              0 0 1 0 0 1 0 0 0 1 0 79
              1 0 1 0 1 0 0 1 0 0 0 62
              0 0 1 0 1 0 1 0 0 0 0 58
              0 0 1 0 0 1 0 1 0 0 0 40
              1 0 1 0 0 1 0 0 1 0 0 70
              1 0 1 0 1 0 0 0 1 0 0 75
              0 0 1 0 1 0 1 0 0 0 0 55
              1 0 1 0 1 0 0 1 0 0 0 43
              0 0 1 1 0 0 1 0 0 0 0 58
              1 0 1 0 1 0 0 0 0 1 0 45
              1 0 1 0 0 1 0 1 0 0 0 55
              0 0 1 0 1 0 0 0 1 0 0 48
              1 0 1 0 1 0 0 0 0 1 0 46
              1 0 1 0 1 0 0 1 0 0 0 36
              0 0 1 0 1 0 0 1 0 0 0 66
              1 0 1 0 0 1 1 0 0 0 0 30
              1 0 1 0 1 0 0 0 1 0 0 40
              1 0 1 0 1 0 0 1 0 0 0 38
              0 0 1 0 1 0 0 1 0 0 0 60
              1 0 1 0 1 0 0 1 0 0 0 35
              0 0 1 1 0 0 0 0 0 1 0 64
              1 0 1 1 0 0 0 0 1 0 0 80
              1 0 1 1 0 0 0 1 0 0 0 48
              0 0 1 1 0 0 0 1 0 0 0 41
              0 0 1 0 0 1 0 1 0 0 0 45
              1 0 1 1 0 0 0 1 0 0 0 51
              0 0 1 0 1 0 0 0 0 1 0 72
              0 0 1 1 0 0 0 0 0 0 1 60
              0 0 1 1 0 0 0 0 0 1 0 55
              1 0 1 0 0 1 0 0 0 0 1 77
              1 0 1 0 0 1 0 1 0 0 0 45
              1 0 1 0 1 0 0 0 0 0 1 50
              1 0 1 0 1 0 0 0 0 0 1 51
              1 0 1 0 0 1 0 0 0 1 0 34
              0 0 1 0 1 0 1 0 0 0 0 37
              0 0 1 1 0 0 1 0 0 0 0 48
              0 0 1 1 0 0 0 0 1 0 0 25
              1 0 1 0 0 1 1 0 0 0 0 31
              1 0 1 1 0 0 0 0 1 0 0 50
              0 0 1 0 0 1 0 1 0 0 0 40
              0 0 1 0 1 0 0 1 0 0 0 53
              1 0 1 0 1 0 1 0 0 0 0 43
              0 0 1 1 0 0 0 1 0 0 0 29
              0 0 1 1 0 0 0 0 0 1 0 38
              1 0 1 0 1 0 1 0 0 0 0 46
              end
              label values outcome yesno
              label def yesno 0 "no", modify
              label def yesno 1 "yes", modify
              
              
              oaxaca outcome (X1: q_d2 q_d3 q_d4 q_d5) (X2: ca_d2 ca_d3) (X3: age), by(r_d2) omega ro
              est sto m1
              
              coefplot (m1, label(Outcome Variable)), drop(overall:group* unexplained:*) xline(0)                              ///
              recast(bar) barwidth(.7) base(0) citop ciopts(recast(rcap))                                                     ///
              xtitle("Percent", size(small)) xlabel(-.05 "-05" 0 "0" .10 "10" .20 "20" .30 "30" .40 "40" .50 "50" .60 "60")   ///
              mlabel format(%9.2g) mlabposition(4)                                                                             ///
              ylab(1 "Diff" 2 "Exp" 3 "Unexp" 5 "X1" 6 "X2" 7 "X3" )
              Code:
               .
              oaxaca
              c:\ado\plus\o\oaxaca.ado
              *! version 4.1.1  24apr2023  Ben Jann
              
              . coefplot
              c:\ado\plus\c\coefplot.ado
              *! version 1.8.6  22feb2023  Ben Jann
              Hope it replicates well and explain my issues.
              Last edited by Mukesh Punia; 17 Apr 2025, 01:29.
              Best regards,
              Mukesh

              Comment


              • #8
                Is there a way to remove the y-axis outer labels (overall, explained, and unexplained)?
                Use the option noeqlabels

                How to convert explained proportion label into a percent (%) e.g in post #1 figure, .41 should appear as 41% or 41.
                I think the best approach here might be to extract the relevant portion of the results matrix, and scale the numbers there. You would then also not need to fiddle with the numbers using xlabel().

                Here are some bits of code suggestions:

                After your oaxaca command, do
                Code:
                matrix C = ( r(table)["b", .] \ r(table)["ll", .] \ r(table)["ul", .] ) * 100
                You can now omit the est sto m1 command since we will plot using matrix C directly. Your coefplot command would now start with
                Code:
                coefplot (matrix(C), label(Outcome Variable)), ci((2 3))
                followed by all the other options (except xlabel)
                Last edited by Hemanshu Kumar; 17 Apr 2025, 01:42.

                Comment


                • #9
                  Thank you!

                  For showing percent the codes only changes the ci's to percent, neither bar nor labels, i.e., .44 to 44.

                  Code:
                  oaxaca outcome (X1: q_d2 q_d3 q_d4 q_d5) (X2: ca_d2 ca_d3) (X3: age), by(r_d2) omega ro
                  matrix C = r(table)["b", .] \ r(table)["ll", .] \ r(table)["ul", .]*100
                  
                  coefplot (matrix(C), label(Outcome Variable)), ci((2 3)) drop(overall:group* unexplained:*) xline(0)            ///
                  recast(bar) barwidth(.7) base(0) citop ciopts(recast(rcap))                                                     ///
                  xtitle("Percent", size(small))                                                                                    ///
                  mlabel format(%9.2g) mlabposition(4)                                                                             ///
                  ylab(1 "Diff" 2 "Exp" 3 "Unexp" 5 "X1" 6 "X2" 7 "X3" ) noeqlabels
                  noeqlabels worked as intended.
                  Best regards,
                  Mukesh

                  Comment


                  • #10
                    For showing percent the codes only changes the ci's to percent, neither bar nor labels, i.e., .44 to 44.
                    Yes sorry I made an error in the original code in #8, which I fixed later. In the matrix definition, you need to enclose the portion before the * 100 in brackets, otherwise it only multiplies the last row by 100.

                    Comment


                    • #11
                      Thank you, very much! Dear Himangshu Kumar it worked perfectly well!

                      Code:
                      oaxaca outcome (X1: q_d2 q_d3 q_d4 q_d5) (X2: ca_d2 ca_d3) (X3: age), by(r_d2) omega ro
                      matrix C = ( r(table)["b", .] \ r(table)["ll", .] \ r(table)["ul", .] ) * 100
                      
                      coefplot (matrix(C), label(Outcome Variable)), ci((2 3)) drop(overall:group* unexplained:* ) xline(0)   ///
                      recast(bar) barwidth(.7) base(0) citop ciopts(recast(rcap))                                                 ///
                      xtitle("Percent", size(small))                                                                                ///
                      mlabel format(%9.1f) mlabposition(4)                                                                        ///
                      ylab(1 "Diff" 2 "Exp"  3 "Unexp" 4 "X1" 5 "X2" 6 "X3" ) noeqlabels
                      * Can we drop the unexplained % from the overall in the figure?
                      Best regards,
                      Mukesh

                      Comment


                      • #12
                        * Can we drop the unexplained % from the overall in the figure?
                        Yes, change the drop option to
                        Code:
                        drop(overall:group* overall:unexplained unexplained:*)
                        Incidentally, you have tagged the wrong person in your last post
                        Last edited by Hemanshu Kumar; 17 Apr 2025, 02:52.

                        Comment


                        • #13
                          * duplicate post; deleted *

                          Comment


                          • #14
                            Thank you!! Hemanshu Kumar for wonderful help and pointing this tagging error alongside codes☺️
                            Thank you and best regards
                            Mukesh
                            Best regards,
                            Mukesh

                            Comment

                            Working...
                            X