XTSTEADYSTATE: Stata module to estimate markov chain distribution dynamics and steady states by Davud Rostam-Afschar
This page illustrates the use of xtsteadystate.ado for Stata.
See Stata. To download the xtsteadystate package including the ado file type in Stata
. net from https://rostam-afschar.de/xtsteadystate
. net install xtsteadystate.pkg
Before running the first set of examples, set up the exemplary dataset by running
. webuse nlswork, clear
. local classes 10
. su ln_wage if year==68
. gen class=(r(max)-r(min))/`=`classes'-1' in 1/`=`classes'-1'
. replace class = sum(class) in 1/`=`classes'-1'
. replace class = class-abs(r(min)) in 1/`=`classes'-1'
. xtile category = ln_wage, cutpoints(class)
. mat n = 5
Example 1: Initial, predicted, and steady state wage distributions
. xtsteadystate category, bar ini ss pred baropt(bar(1, color("16 212 160")) ///
bar(2, color("212 17 89")) bar(3, color("26 133 255")))
Example 2: Transitions from wage class to wage class
. xtsteadystate category, graph3d graph3doptions(yangle(-45) xangle(80) ///
ycam(-4) zcam(-18) cuboid innergrid blv perspective ///
colorscheme(bcgyr) xlabel(" {&darr} from wage class {&darr}") xlpos(1) xlang(-41) zlabel("{&darr} to wage class {&darr}") zlpos(12) zlang(40) wire mark) graph3dscalez(20)
Example 3: Wage dynamics by distribution
. xtsteadystate category, tw 3dists ini ss pred ///
twowayopt(title("Dynamics of the Wage Distribution") ///
plotregion(margin(4 4 1)) ylabels(0(0.1)0.3) ///
ytitle("Predicted Probability After Iteration `=`n'[1,1]'"))
Example 4: Wage distribution dynamics by distribution
with standard errors
. xtsteadystate category, boot tw 3dists ini ss pred ///
twowayopt(title("Dynamics of the Wage Distribution") ///
plotregion(margin(4 4 1)) ylabels(0(0.1)0.3) legend(rows(3)))
Example 5: Wage distribution dynamics by class
with standard errors
. xtsteadystate category, boot tw 1dist ini ss pred ///
twowayopt(title("Dynamics of the Wage Distribution") ///
plotregion(margin(4 4 1)) ylabels(0(0.1)0.3) ///
ytitle("Frequencies"))
Before running the second set of examples, set up the exemplary dataset by running
. webuse nlswork, clear
. local classes 4
. su ln_wage if year==68
. gen class=(r(max)-r(min))/`=`classes'-1' in 1/`=`classes'-1'
. replace class = sum(class) in 1/`=`classes'-1'
. replace class = class-abs(r(min)) in 1/`=`classes'-1'
. xtile category = ln_wage, cutpoints(class)
Example 6: Difference in wage dynamics between groups
. gen treatment = 0 if race==2
. replace treatment= 1 if race==1
. xtsteadystate category , boot diff 3dists tw ini pred ss ///
twowayoptions(ylabels(-.15(0.05).15))
Example 7: Difference in wage dynamics
between groups and over time
. gen post= 0 if year<80
. replace post= 1 if year>=80
. xtsteadystate category , boot did 3dists tw ini pred ///
twowayoptions(ylabels(-.1(0.02).1))
Authors
Davud Rostam-Afschar
Universität Mannheim
rostam-afschar@uni-mannheim.de