I want to convert my transition matrix (see data/code below) into a "transition bar chart" as mentioned in these slides: https://www.stata.com/meeting/boston...14_nichols.pdf
That is, I want to plot the output of my tabulate command. There would be one bar each for the three values of lag_x (value of x in 2018) as shown in the screenshot attached which I made in excel. The composition of each bar would be according to the rows in the tabulate output: i.e. the values of x in 2019.I want to make many such figures and am looking for a way to do this in Stata.
Any help would be greatly appreciated!
Thanks.
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input float(id year) str1 lag_x str32 x 167 2018 "" "C" 167 2019 "C" "C" 168 2018 "" "C" 168 2019 "C" "C" 169 2018 "" "C" 169 2019 "C" "B" 170 2018 "" "B" 170 2019 "B" "B" 171 2018 "" "A" 171 2019 "A" "C" 172 2018 "" "B" 172 2019 "B" "C" 173 2018 "" "C" 173 2019 "C" "C" 174 2018 "" "A" 174 2019 "A" "C" 188 2018 "" "A" 188 2019 "A" "A" 189 2018 "" "C" 189 2019 "C" "C" 246 2018 "" "C" 246 2019 "C" "C" 247 2018 "" "C" 247 2019 "C" "C" 248 2018 "" "C" 248 2019 "C" "C" end qui tsset id year * transition matrix tab lag_x x, row nofreq
0 Response to transition matrices in bar charts
Post a Comment