Announcement

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

  • addplot error after marginsplot

    I ran a model (dependent variable = gender) and 3 independent variables – year, position_department_n, and interaction of year and position_department_n. I’d like to show a plot with predicted probabilities with panels for each position_department_n, and add the observed data to the same graph. I can get the first part (predicted probabilities by position_department_n), by adding bydimension(position_department_n) to marginsplot (code below).

    However, when I use addplot to add in the observed data, I get an error: "Graph family bygraph_g does not support addplot. r(198);". Is there a way around this to achieve what I am trying to do?

    Code:
    . quietly mlogit gender_n c.year##i.position_department_n, rrr vce(cluster person)
    
    . quietly margins i.position_department_n, at(year=(1(1)7))
    
    .
    . **WITHOUT ADD PLOT
    .
    . marginsplot, bydimension(position_department_n) legend(pos(3)) recast(line) plot1opts(lcolor(gs8)) ciopt(color(black%20)) recastci(rarea) ytitle("Propor
    > tion") plotd(,label( "F" "M" "U"))
    
      Variables that uniquely identify margins: year position_department_n _outcome
    
    
    Click image for larger version
    
    Name:	madeup-1.png
    Views:	1
    Size:	132.2 KB
    ID:	1633968
    
    .
    . **WITH ADDPLOT
    .
    . marginsplot, bydimension(position_department_n) legend(pos(3)) recast(line) plot1opts(lcolor(gs8)) ciopt(color(black%20)) recastci(rarea) ytitle("Propor
    > tion") plotd(,label( "F" "M" "U")) addplot((scatter prop year if gender_n==4, msymbol(circle) mcolor(black) msize(vsmall)) (scatter prop year if gender_
    > n==5, msymbol(circle) mcolor(black) msize(vsmall)) (scatter prop year if gender_n==6, msymbol(circle) mcolor(black) msize(vsmall)))
    
      Variables that uniquely identify margins: year position_department_n _outcome
    Graph family bygraph_g does not support addplot.
    r(198);
Working...
X