I need your help for plotting the results of margins in a nice and straightforward way. I am wondering whether margins can be visualized as a cumulated bar graph/stacked bar graph.
The variabes are: ageg (dependent variable is economic status: employed, unemployed, inactive; age groups: 25-34, 35-44; period: 2004-2005, 2006-2007 and so on till 2018).
What I want to see: for each period (on the x axis), I wish to see the predicted probabilities of being employed, unemployed, inactive for 25-34 and 35-44 years old individuals. The best solution is to have two stacked bars for each ageg in all periods, but I can also have two different graphs, one for the younger and one for the older agegroup.
Until now I got the following graphs from these commands, but I don't think they are clear enough :
Code:
a) margins ageg, at (period=(0 1 2 3 4 5)) marginsplot, recast (bar)
Array
Below I tried to have a graph for one category of Y (unemployed), but I am missing the ageg 35-44 years old, why? How can this graph be interpreted?
Code:
b) margins ageg, predict(outcome(0)) at (period=(0 1 2 3 4 5)) marginsplot, recast(bar)
Lastly, I need separate results for each age group for males and females separately. My margins command is the following, but I coudn't graph it, the result is too confusing.
c) margins ageg#female, predict(outcome(0)) at (period=(0 1 2 3 4 5))
Can someone please help me out or propose alternative ways to visualize the margins results (but always as cumulated bars)? I thought that I can input manually the percentage I got from margins and create in this way a stacked bar graph. Is it possible? How?
Thanks for reading!
Chiara
0 Response to Stacked graph bar with marginsplot ?
Post a Comment