In the same spirit, and standing on Vince's shoulders (*),
------------------------------- myhistogram.do
qui su `0'
local imin = ceil((r(min) - r(mean))/r(sd))
local imax = floor((r(max) - r(mean))/r(sd))
forval i = `imin'/`imax' {
local labels `"`labels' `= r(mean) + (`i') * r(sd)' "`i'" "'
}
set graphics off
histogram `0', t1(z scale)
.Graph.insert (.xaxis2 = .axis.new , position(above)) above plotregion1
.Graph.set_axis_plotregion xaxis2 plotregion1 x
.Graph.xaxis2.major.add_ticks `labels'
set graphics on
graph display
-----------------------------------
This should work as follows:
do myhistogram systolic
do myhistogram systolic if female
etc.
Nick
[email protected]
(*) A book on catastrophe theory bore a dedication to a beloved mentor:
"at whose feet we sit, on whose shoulders we stand". Only topologists could
visualise the resulting position.
Christopher F Baum
> Please see Vince Wiggins' talk from the London meetings, where he
> presented code to do something like that in the example using US
> states.
>
> http://ideas.repec.org/s/boc/usug04.html
>
Richard T. Campbell
> > For teaching purposes,I would like to display a histogram with
> > overlaid normal density. I would like to display two x axes on this
> > graph, one in the scale of the original variable, say systolic blood
> > pressure and the other in the Z transform of that variable I can't
> > seem to figure out how to do that. Can someone help?
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/