Dear Statalisters.
Hope this question/message finds you well. I am posting regarding an issue with marginsplot after running svy mlogit. So here I have a five-category response variable, usualpl, which was label valued with a format. Then I run the following svy mlogit of usualpl on a series of dummy variables for race/ethnicity (raceethn), along with a series of controls. Then I use the margins command to run prediction, followed by marginsplot to plot the predictions. There are 14 racial/ethnic groups and five outcomes for the response variable. My problems are with the plot. Although the five-category response variable, usualpl, was properly valued and labelled, the legend of the marginsplot still shows text descriptions like outcome 1, outcome 2,..., outcome 5. Also note that in the following I specified the symbol shapes in msymbol option, but the program only uses the first marker shape Oh. So my specific questions would be how to vary the markers and change the symbols and text description in the legend of marginsplot. Any pointer or good examples would be much appreciated.
Jun Xu, PhD
Professor
Data Analytics/Science Program
Department of Sociology
Ball State University
Web: sites.google.com/site/socjunxu
Hope this question/message finds you well. I am posting regarding an issue with marginsplot after running svy mlogit. So here I have a five-category response variable, usualpl, which was label valued with a format. Then I run the following svy mlogit of usualpl on a series of dummy variables for race/ethnicity (raceethn), along with a series of controls. Then I use the margins command to run prediction, followed by marginsplot to plot the predictions. There are 14 racial/ethnic groups and five outcomes for the response variable. My problems are with the plot. Although the five-category response variable, usualpl, was properly valued and labelled, the legend of the marginsplot still shows text descriptions like outcome 1, outcome 2,..., outcome 5. Also note that in the following I specified the symbol shapes in msymbol option, but the program only uses the first marker shape Oh. So my specific questions would be how to vary the markers and change the symbols and text description in the legend of marginsplot. Any pointer or good examples would be much appreciated.
Jun Xu, PhD
Professor
Data Analytics/Science Program
Department of Sociology
Ball State University
Web: sites.google.com/site/socjunxu
Code:
svy: mlogit usualpl i.raceethn educ age fmle married nativeVar income engprof insured genhlth, base(5) margins i.raceethn marginsplot, xlabel(, angle(45)) /// xtitle("Race/Ethnicity", size(*0.8)) ytitle("Pr(Usual Place of Care|x)") /// title("Prob. of Usual Place of Care by Race/Ethnicity") /// plotopts(msymbol(Oh Dh Sh Th +)) /// legend(size(*0.5) title("Usual Source of Care") row(1) /// lab(1 "1Office" 2 "2Clinc" 3 "3ER" 4 "4Other" 5 "5No"))
Comment