lasasgurus.blogg.se

Stata histograms
Stata histograms








stata histograms

Thanks to Maxim Massenkoff for submitting the additional code and figure. (histogram write if female=0, start(30) width(5) color(green%30)), /// Twoway (histogram write if female=1, start(30) width(5) color(red%30)) /// So 100% opacity is the same as the original histogram. The higher the opacity, the less transparent the histogram will become. The option color(red%30) makes the female histogram red with 30 percent opacity and color(green%30) makes the male histogram green with 30 percent opacity. Transparency is specified as a color modifier. Now the we can see that females have more density to the right of the graph while the males have more density towards the left side.Īn even better method is to add transparency, which became available as of Stata 15. (histogram write if female=0, start(30) width(5) ///įcolor(none) lcolor(black)), legend(order(1 "Female" 2 "Male" )) The lcolor(black) option sets the line color to black. Stata module to produce binned scatterplot with marginal histograms. The option fcolor(none) sets the fill color to none while binscatter, the tools to furthermore plot histograms of the scattered variables. So, let’s render the male histogram as transparent rectangles withīlack outlines. That’s a bit better, but parts of the male histogram still block out our view of theįemale histogram. (histogram write if female=0, start(30) width(5)), /// Twoway (histogram write if female=1, start(30) width(5) color(green)) /// Option, which sets both the fill color and line color to green. Let’sĬhange the female histogram color to green.

stata histograms

Both histograms were rendered in the same color. (histogram write if female=0, start(30) width(5)) Twoway (histogram write if female=1, start(30) width(5)) /// Let’s load the hsbdemoĭataset and overlay histograms for males and female for the variable write. Figure 7.1 Histogram of two groups on one graph Figure 7.1 Code Figure 7.2 Two pannel or overlapping density plots for two groups Figure 7.2 Code Figure 7.3. This sounds like it should be pretty easy.










Stata histograms