I am looking to build a graph similar to this in STATA. I have 6 periods (pre, protocol rollout, protocol, post-rollout, post, sustainability), I would like to graph my ITSA data to show that wages were increased during the protocol phase and continued to increase during the post or sustained. I used the data example below.
I used the below code but I am getting really strange graphs. Can you help show what I am doing wrong? Should I be using margins plots instead? How do I add a scatter with margins plots?
sysuse uslifeexp.dta
mkspline t1 0 t2=year
mixed le i.year
gen season=.
replace season=0 if year<1915
replace season=1 if year>=1915 & year<1920
replace season=2 if year>=1920 & year<1940
replace season=3 if year>=1940 & year<1960
replace season=4 if year>=1960 & year<1980
replace season=5 if year>=1980
tab season
tw scatter le year || lfit le year if season==0||lfit le year if season==1||lfit le year if season==2||lfit le year if season==3||lfit le year if season==4||lfit le year if season==5
I used the below code but I am getting really strange graphs. Can you help show what I am doing wrong? Should I be using margins plots instead? How do I add a scatter with margins plots?
sysuse uslifeexp.dta
mkspline t1 0 t2=year
mixed le i.year
gen season=.
replace season=0 if year<1915
replace season=1 if year>=1915 & year<1920
replace season=2 if year>=1920 & year<1940
replace season=3 if year>=1940 & year<1960
replace season=4 if year>=1960 & year<1980
replace season=5 if year>=1980
tab season
tw scatter le year || lfit le year if season==0||lfit le year if season==1||lfit le year if season==2||lfit le year if season==3||lfit le year if season==4||lfit le year if season==5