Announcement

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

  • combomarginsplot (two y axis)

    Hello Everyone,

    I hope someone would be able to help me with the following:

    I have this code:

    Code:
        eststo: reghdfe Man2Auto l.sharpe_ratio l.PercentAutoBid l.c.PercentAutoBid#l.c.PercentAutoBid ///
        l.c.sharpe_ratio#l.c.PercentAutoBid l.c.sharpe_ratio#l.c.PercentAutoBid#l.c.PercentAutoBid, a(LenderId hour LoanId) cluster(interaction)
                estadd local LenderId "Yes", replace
                estadd local hour "Yes", replace
                estadd local LoanId "Yes", replace
    
        est store AutoSwitching
        nlcom -_b[l.PercentAutoBid]/(2*_b[l.c.PercentAutoBid#l.c.PercentAutoBid])
        margins,at(l.PercentAutoBid = (0(0.1)1)) saving(file1, replace)
        margins,dydx(l.sharpe_ratio) at(l.PercentAutoBid = (0(0.1)1)) saving(file2, replace)
        
        combomarginsplot /*
        */ file1 file2, plot1opts(lc(black) lp(longdash_dot)) ciopt(color(black)) plotopts(mcolor("black")) /*
        */ labels("Share Auto Bidding" "Sharpe Ratio") xline(.786, lstyle(grid) lp(longdash_dot) lc(maroon)) xti("Share Auto Bidding") /*
        */ text(0.04 0.77 "Turning Point at 0.786", place(s) orient(vertical) color(black) size(small)) /* 
        */ yti("Probability") name(plot1, replace)
    The figure I produce is okay, except for an issue with the Y-axis. It generates a Y-scale between -0.4 and 0.4, which is suitable for the 'sharpe_ratio' which is great.
    However, I also want to add another Y-scale on the right side for 'PercentAutoBid', with a range from 0 to 0.15. The problem with the current version of the figure is that the scale of sharpe_ratio is larger than PercentAutoBid. PercentAutoBid shows non-linear relationship If I plot it on its own.
    But when I plot it with sharpe_ratio, the scale of PercentAutoBid is much smaller and it looks just looks different (more like a straight line).

    Thank you in advance.

  • #2
    If anyone knows how to add another Y-axis to a combomarginsplot, could you please guide me?

    Any help is appreciated.

    Thanks

    Comment

    Working...
    X