Announcement

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

  • Combine marginsplot - problem with plot options

    I am trying to combine two (hopefully more) marginsplot using combomarginsplot. My code is the following:

    Code:
    xtreg yvar1 c.xvar##c.xvar 
    margins, at(xvar = (-14.5(2)33.3)) saving(file1, replace)
    
    xtreg yvar2 c.xvar##c.xvar 
    margins, at(xvar = (-14.5(2)33.3)) saving(file2, replace)
    
    combomarginsplot file1 file2, recast(line) recastci(rarea) plotopts(lcolor(dknavy)) ci1opts(color(ltblue)) ///
        xlabel(#3, nogrid)ylabel(, nogrid) graphregion(color(white)) labels("YVAR1" "YVAR2")
    I would like to specify the line color and CI color for each of the marginsplot but it seems that I can only specify the following once
    Code:
    plotopts(lcolor(dknavy)) ci1opts(color(ltblue))
    Is it possible to specify the colors for the second plot and its CI as well?

    Thank you!

  • #2
    Hi,
    Note that -combomarginsplot- is a user-written program (by me) available on SSC.

    NOte that in addition to plotopts() and ciopts() , you can also specify one or more plot#opt() and ci#opt() options to apply options to specific plots and CIs. These correspond to the same options in Stata's -marginsplot-.

    Code:
    combomarginsplot file1 file2, recast(line) recastci(rarea) ///
           plot1opt(lcolor(red)) plot2opt(lcolor(orange)) ///
           ci1opt(color(green)) ci2opt(color(purple))
    In addition, because each margins file can itself have more than one plot, -combomarginplot- also also the options lplot#opts() and lci#opts() which apply options to the #th plot from each margins file. And the file#opts() and fileci#opts() apply options to all the plots and CIs, respectively, from the specified file.

    Comment


    • #3
      Nicholas Winter, thank you for your reply. The program is brilliant!

      I am coming to terms with the various options and have used the ci#opts() for the CI properties but now will use the file#opts() for further manipulation. Thanks again.

      Comment


      • #4
        I have overlapping and wide confidence intervals for the predictive margins I have produced for my data (table below). The outcome variable is the use of ANC. With this 95%CI, can I conclude that an effect present on the outcome varibale with certainity? Your advice is much appreciable.
        MM*SH 0.72 (0.55-0.89)
        EC3*E0 0.53 (0.46-0.60)
        EC3*E1 0.54 (0.48-0.60)
        EC3*E2 0.67 (0.58-0.75)
        Last edited by Alem Desta; 25 Jan 2022, 04:19.

        Comment

        Working...
        X