Dear StataList,
I have a question regarding bin width in histograms.
I cannot manage to create bins of equal width. It seems that Stata automatically adjusts bin widths, even when I explicitly set the width.
This can be seen in the code below (which uses the classic auto data in case one of you is kind enough to try):
clear all
sysuse auto
summarize price
twoway__histogram_gen price ///
, ///
percent width(300) start(3000) ///
gen (frequency bound)
keep bound frequency
order bound frequency
The "bound" variable is the midpoint of the bins, which is not increasing by a constant increment of 300.
Would you know what I am missing here?
My goal is to export the constant bins and corresponding percents to Excel, which is why I use "twoway histogram".
Many thanks for your consideration, and stay healthy.
Best regards,
Marc
0 Response to Bin widths are not constant in histogram
Post a Comment