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
interaction effects: Poisson or Double-limit TobitHi All, I am working with the DHS data across five countries and looking at relationship between wo…
Taking the average of observations within a specific date rangeHi, I want to compute the average of a variable (teamsize) for observations within a specific time…
How to filter dates within an interval from a set of observationHello, i have a dataset of around 900,000 observations from about 130,000 ids. The variables i am w…
Create a two-way line graph/bar chartHi all I want to create a line graph/bar chart which looks at the consumption of 3 main fertilizers…
Estimation output for Svy: meologit and melogit commandsHi all, I am using Stata 14.1 and i am getting an odd but of output. I am estimating a series of m…
Subscribe to:
Post Comments (Atom)
0 Response to Making a figure including confidence intervals for multiple groups
Post a Comment