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
- How to specify Study ID using metaprop command in meta-analysis output table?Hello I am struggling to specify study ID variable in the metaprop command below: metaprop num deno…
- double quotation marks or single quotation marksWhether it is using double quotation marks or single quotation marks, an error will be reported. Wha…
- The use of p-values has been criticized by the American Statistical Association.Hi everyone, My research area is economic and I use panel data of listed firms in the USA from 2000…
- How to find the key variables in a given dataset?Hi there, Like the title of the topic mentioned, I met a problem when I'm analyzing a dataset. The …
- FiltersHow do I filter out respondents which have missing values in more than 50% of the variables I want t…
Subscribe to:
Post Comments (Atom)
0 Response to Making a figure including confidence intervals for multiple groups
Post a Comment