Announcement

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

  • Labelling axis using values from another variable

    I am using coefplot to show the estimation coefficients. The independent variable is categorized into its deciles. How can I show the decile values (stored in x_deciles) on the chart x-axis label instead of the D_x levels?

    Code:
    xtile D_x=x, nq(10)
    pctile x_deciles= x , nq(10)
        
    mlogit y  i.D_x, baseoutcome(1) rrr
    
    coefplot (., keep(2:   2.D_x 3.D_x 4.D_x)), vertical coeflabels("2.D_x"=x_deciles[_2] "3.D_x"=x_deciles[_3] "4.D_x"=x_deciles[_4] )

  • #2
    coefplot is from SSC, as you are asked to explain in FAQ Advice #12. Data example?

    Comment


    • #3
      Thanks Andrew, Here is an example:
      Code:
      sysuse auto, clear
      xtile D_x=rep78, nq(3)
      pctile x_deciles= rep78 , nq(3)
      
      mlogit foreign  i.D_x, baseoutcome(1) rrr
      
      coefplot (., keep(2.D_x 3.D_x)), vertical
      How can I change the labels of the x-axis to show the quantiles stored in x_deciles?

      Comment


      • #4
        Code:
        sysuse auto, clear
        xtile D_x=rep78, nq(3)
        pctile x_deciles= rep78 , nq(3)
        mlogit foreign i.D_x, baseoutcome(1) rrr
        coefplot (., keep(2.D_x 3.D_x)), vertical xlab(1 "`=x_deciles[1]'" 2 "`=x_deciles[2]'")
        Res.:

        Click image for larger version

Name:	Graph.png
Views:	1
Size:	16.0 KB
ID:	1755671

        Comment

        Working...
        X