Dear Stata-users,
As I was working on my thesis, I was wondering about the following. I have made two figures with confidence intervals for a variable on expected retirement age (called 'rretage') per gender (called 'ragender') and grouped by current age of respondents (called 'ragey_e'). I have included the code below:
preserve
collapse (mean) mrretage = rretage (sd) sdrretage = rretage (count) nrretage = rretage if ragender ==1 , by(ragey_e)
generate rretageucl = mrretage + 1.96*sdrretage/sqrt(nrretage)
generate rretagelcl = mrretage - 1.96*sdrretage/sqrt(nrretage)
twoway rcap rretagelcl rretageucl ragey_e, xtitle(Current age) ytitle(Expected retirement age) subtitle(By current age) saving(confidenceintmales.gph)
restore
preserve
collapse (mean) mrretage = rretage (sd) sdrretage = rretage (count) nrretage = rretage if ragender ==2 , by(ragey_e)
generate rretageucl = mrretage + 1.96*sdrretage/sqrt(nrretage)
generate rretagelcl = mrretage - 1.96*sdrretage/sqrt(nrretage)
twoway rcap rretagelcl rretageucl ragey_e, xtitle(Current age) ytitle(Expected retirement age) subtitle(By current age) saving(confidenceintfemales.gph)
restore
They look like the picture I added (after combining the figures).
My question is: Is there a way to combine the confidence intervals into one figure, i.e. place them 'over' each other with different colors?
Hope someone can help and please let me know if my question is not clear.
Best,
Floor
Related Posts with Making a figure including confidence intervals for multiple groups
Profit frontierHello, I have estimated the stochastic profit frontier but I need assistance on how to estimate allo…
Corrado Rank testDear colleagues, good afternoon I have got a vertical dataset consisting of two variables ar and co…
Geonear commandHi there! I have been trying to use the Geonear command but I am getting a r(459) error stating tha…
intra class correlationHi to everybody, I' ve to calculate ICC (It's for me the first time) I'll try to explain the proble…
Can lrtest be performed with sqreg or if not what is the alternative method.Dear All, As part of my research, I have conducted the LR test to compare both the unrestricted and…
Subscribe to:
Post Comments (Atom)
0 Response to Making a figure including confidence intervals for multiple groups
Post a Comment