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
Three-dimensional surface plots of marginal predictions using PythonDear all, I just had access to the Stata 16.0 version and I am really excited because of it. It's ju…
Global macro for a directory using project fileThe following commands are fickle, not reliable, working sometimes and not at others. I use a projec…
Transpose regression table, adding S.E. and P valueHello There, I am currently trying to transpose my regression results (i.e having one model in a ro…
Model for Panel Data with time-variant DV and time-invariant IVsHello, My panel data is short (N>T) and I would like to regress 4 time invariant IV on 1 time va…
How to use estat concordance in a validation sample Hi, I am trying to internally validate the Cox proportional hazard model. I have split data (70% on…
Subscribe to:
Post Comments (Atom)
0 Response to Making a figure including confidence intervals for multiple groups
Post a Comment