Announcement

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

  • Add Y-label and Vertical Bar Label to Graph Options

    Hi all,

    I am using rdpow from ssc. I am interested in modifying the graph that this user-written command produces through the graph_options option. Namely, I would like to label the values of the y-axis and add a vertical line to the x-axis. This vertical line should carry the label, visible on the graph itself, "Mean of Dep. Var." The vertical line should be at x=2.02.

    Here is the code I've tried:

    Code:
    rdpow y running_var , tau(5) plot graph_options(xla(-7.5 -5 -2.5 0 2.5 5 7.5) yla(.1 "10%" .2 "20%" .3 "30%" .4 "40%" .5 "50%" .6 "60%") xaxis(1 2) xline(2.02) xlabel(2.02 "Mean of Dep. Var.", axis(2)) xtitle("",axis(2)) title(Power Function) xtitle(Magnitude of Effect to Detect) ytitle(Power)) covs($covs) vce(cluster county)
    This is the error I got:

    Code:
    xlabels(2.02 Mean of Dep. Var. , axis(2)) not allowed, xaxis2 does not exist
    When I remove
    Code:
    xaxis(1 2) xline(2.02) xlabel(2.02 "Mean of Dep. Var.", axis(2)) xtitle("",axis(2))
    and only try to label the y axis, I get:

    Code:
    invalid label specifier, :  .1 10% .2 20% .3 30% .4 40% .5 50% .6 60%:

    Could someone please let me know what I am doing wrong?

    Thanks in advance!

  • #2
    Have you gotten this idea to work on a simple data example in a do file? I'm no stranger to modifying others ado files, but before I do I ensure that whatever modification I desire works outside of the ado file first on a simple example, in a do file. As it stands though, I'm unsure at to why you get this error

    Comment


    • #3
      rdpow is from Stata Journal, not SSC.

      Clearly the "" you're trying to pass. get stripped,

      I would try cloning the program under a different name and replacing

      Code:
      graph_options(string)
      in the syntax statement with

      Code:
      graph_options(string asis)
      and any check for

      Code:
      "`graph_options'" == ""
      with

      Code:
      `"`graph_options'"' == ""

      Comment


      • #4
        Dear both,

        Thank you very much for your replies.

        Jared Greathouse - You're right, the thing is for the results to make sense with my data, I would have had to post hundreds of rows of data. But now that you mention it, I should have used the rdrobust_senate file as dataset, from the seminal RDD study.

        Nick Cox - I will give it a try and get back to you. Thank you for the suggestion!

        Comment


        • #5
          Another option is to save the generated graph (GPH file) and edit it with addplot from SSC. See

          Code:
          ssc desc addplot

          Comment

          Working...
          X