Announcement

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

  • marginsplot - is it possible to hide a value

    Hello I have a categorical variable <paprosky> and another binary categorical variable <revised>
    I would like to show that the higher the value in <paprosky> the more likely it is going to be revised

    I have managed to plot this as seen below however I ideally I would have wanted something of the sort. I have previously plotted somethings similar however it was only possible as the independent variable ie paprosky was continuous and this time as they are both categorical I am not able to plot the straight lines

    Click image for larger version

Name:	Screenshot 2024-05-16 at 10.54.54.png
Views:	1
Size:	67.0 KB
ID:	1753534




    Code:
    ///Current code for bar charts: 
    
    ologit paprosky revised age, or
    
    ///2a
    margins, at(revised=(0/1)) predict(outcome(1)) atmeans
    marginsplot, ytitle ("Probability = Revision risk Paprosky 2A") plot(revised) recast(bar) allxlabels by(revised) name(m1, replace)
    
    //2b
    margins, at(revised=(0/1)) predict(outcome(2)) atmeans
    marginsplot, ytitle ("Probability = Revision risk Paprosky 2B") plot(revised) recast(bar) allxlabels by(revised) name(m2, replace)
    
    //2c
    margins, at(revised=(0/1)) predict(outcome(3)) atmeans
    marginsplot, ytitle ("Probability = Revision risk Paprosky 2C") plot(revised) recast(bar) allxlabels by(revised) name(m3, replace)
    
    
    //3a
    margins, at(revised=(0/1)) predict(outcome(4)) atmeans
    marginsplot, ytitle ("Probability = Revision risk Paprosky 3A") plot(revised) recast(bar) allxlabels by(revised) name(m4, replace)
    
    
    //3b
    margins, at(revised=(0/1)) predict(outcome(5)) atmeans
    marginsplot, ytitle ("Probability = Revision risk Paprosky 3B") plot(revised) recast(bar) allxlabels by(revised) name(m5, replace)
    
    graph combine m1 m2 m3 m4 m5, note("Probability of revision on Paprosky severity")ycommon name(g2, replace)


    Click image for larger version

Name:	Screenshot 2024-05-16 at 10.50.41.png
Views:	1
Size:	754.0 KB
ID:	1753533


Working...
X