Richard Hisock wrote:
I am trying to create a frequency histogram where bins consist
of cuts of a variable (proportion of observations therefore
range [0,1]) in 0.1 bins sizes.
In Stata v9 using histogram..., width(0.1) start(0(0.1)1) the bins
appear to be constructed [0,0.1) [0.1 ,0.2) ... & finally [0.9,1]
Is it possible to change the bin limits (0,0.1] (0.1,0.2] so that
the upper limit is exclude from the bin?
Or should I just reset the bin limits for example
...,width(0.1) start (0(0.10001)1) xlab(0(0.1)1)?
-----------------------------------------------------------------------
My Stata 9.2 does not accept
histogram ... , start(0(0.1)1)
but it does accept
histogram ... , start(0) width(0.1)
I made this experiment:
clear
set obs 100
gen x=int(10*uniform())/10
tab1 x
histogram x , start(0) width(0.1) frequency
and found (as expected) that it was not predictable whether, e.g.,
0.7 was included in the bin below or above 0.7.
One possible solution is:
generate x1 = x+0.00001
histogram x1 , start(0) width(0.1) frequency
Hope this helps
Svend
__________________________________________
Svend Juul
Institut for Folkesundhed, Afdeling for Epidemiologi
(Institute of Public Health, Department of Epidemiology)
Vennelyst Boulevard 6
DK-8000 Aarhus C, Denmark
Phone: +45 8942 6090
Home: +45 8693 7796
Email: [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/