Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: graphing normally distributed variables


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   st: RE: graphing normally distributed variables
Date   Thu, 31 Jul 2003 12:21:04 +0100

victor michael zammit

> What I am trying to do here,is to take any normally 
> distributed variable
> ,that is to say ,with any mean and standard deviation ,and 
> disect it into 50
> equal intervals (bins) ,and then compare the two 
> distributions.I would
> appreciate any comments on how this could be done differently :
> 
> capture program drop bins
> program define bins

< code > 

You are using some version of Stata <= 7. 

Your program generates a normal with 
10,000 observations and then draws a 
histogram using -graph- and a frequency 
polygon. 

You could make your program less noisy 
by slapping 

quietly { 

} 

around the calculations. Apart from that, 
I don't know what to say as I don't really 
understand what you want to do which is not 
already supported. 

What two distributions do you want to 
compare? 

If the problem is to compare a 
variable with a reference normal, there 
are at least two ways to do it graphically 
in Stata <= 8. 

1. -graph, histogram normal- 
2. -qnorm- 

In my experience the second is much more
effective at respecting coarse and fine 
structure. The binning of the histogram 
inevitably loses information. 

If you seek a histogram with more than 
50 bins, -histplot- on SSC might serve 
(but that is _no_ interest to Stata 8 
users). 

Nick 
[email protected] 
*
*   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/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index