Announcement

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

  • Marginsplot axes

    I am currently using marginsplot to graph predicted margins from a multivariable logistic regression. I have a couple of issues;
    1) First off, the confidence intervals extend in one of the x variables, beyond zero and 1. I would like them to "stop" at these limits in the graph.
    2) I am using marginsplot with addplot to also present bar graphs for the sample size for each of the x variables. I can't seem to find a means to move the second y axis to the right. it "insists" on staying on the left.
    marginsplot, title ("Composite") subtitle("NeuroSurgery") ytitle(Predicted Proportion) plotopts(connect(i)) ///
    ylabel(0(0.1)1.1) yline(0.532) xlabel(1(1)31, labels angle(45) labsize(*0.6)) ///
    addplot(bar MRPCount_comp NSmrp, fcolor(none) lcolor(red) lwidth(thin) yaxis(2) ///
    legend(order(2 "Composite" 3 "Count")) ytitle(Survey Count, axis(2)) xlabel(1(1)9) xtitle(Surgeon))

    thanks

  • #2
    Hi Fraser, I had also the second of your problems.

    You can solve it by using the "yscale" with the "alt" command (in addition to the yaxis(2) command): yscale(alt axis(2))

    In your case it would be:
    marginsplot, title ("Composite") subtitle("NeuroSurgery") ytitle(Predicted Proportion) plotopts(connect(i)) ///
    ylabel(0(0.1)1.1) yline(0.532) xlabel(1(1)31, labels angle(45) labsize(*0.6)) ///
    addplot(bar MRPCount_comp NSmrp, fcolor(none) lcolor(red) lwidth(thin) yaxis(2) yscale(alt axis(2)) ///
    legend(order(2 "Composite" 3 "Count")) ytitle(Survey Count, axis(2)) xlabel(1(1)9) xtitle(Surgeon))

    Best regards,
    Marc

    Last edited by Marc Guinjoan; 17 Sep 2018, 11:06.

    Comment

    Working...
    X