All--
Probably the other sources of help or examples cited below are a poor
substitute for
help twoway bar##remarks3
combined with -egen- and -collapse- as necessary (though it is the
-egen- and -collapse- step that no doubt is confusing to most users
who want to create their own variant on a histogram), but I agree with
other posters that the bihistogram or population pyramid often
obscures rather than illuminates, and I tend to prefer overlaid kernel
density plots to various alternatives (but there will be issues of
bandwidth or bin selection in any solution, I think).
One can even use -kdensity- or -tw kdensity- with already aggregated
data, though it stands out in part because it does not require the
data to be already binned and collapsed (and allows weights); using a
rectangular kernel you can in fact produce a histogram. But compare
the output to an "overlaid histogram" by pasting this into your
Command window:
sysuse pop2000, clear
ren agegrp a
ren maletotal m
ren femtotal f
loc c `"bw(.5) k(rec) yti("") xti("")"'
loc c `"`c' yla(,angle(0)) ysc(r(0)) xla("'
forv i=1/17 {
loc c `"`c' `i' "`:label (a) `i''""'
}
loc o `", `c',labs(tiny)) leg(lab(1 "Male") lab(2 "Female"))"'
tw kdensity a [aw=m]`o'||kdensity a [aw=f]`o' name(k, replace)
g a1=a*3-1
g a2=a*3
cap labmask a1, val(agestr)
if _rc!=0 {
ssc inst labutil
labmask a1, val(agestr)
}
loc o `"yti("") yla(,angle(0)) ysc(r(0)) xla(2(3)50,val labs(tiny))"'
tw bar m a1 || bar f a2,`o'
On Tue, Aug 26, 2008 at 5:30 PM, Sergiy Radyakin <[email protected]> wrote:
> Hi there!
>
> What is the difference between bihistogram and a population pyramid?
> Is it another way of drawing (horizontal vs vertical)? Or is it just
> another term?
>
> If so, this might be helpful:
> http://www.ats.ucla.edu/stat/Stata/library/GraphExamples/code/twobar4.htm
>
> and this too:
> net search pyramid
<snip>
>> On Tue, Aug 26, 2008 at 1:54 PM, Austin Nichols <[email protected]> wrote:
>> > See also
>> > http://www.stata.com/support/faqs/graphics/gph/graphdocs/twbar3.html
>> > but I would fix the negative labels--no reason not to make them
>> > positive in both directions.
<snip>
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/