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
Related Posts with Bin widths are not constant in histogram
Creating missing value mechanismsHi, I would have a full dataset with an outcome variable y and a two predictors x1 and x2 and 100 o…
Preparing data for competing risksHi everyone I have four variables: Event 1 (1: yes, 0: no), time to event 1 (years); event 2 (1: yes…
Monthly Unemployment Rate Calculation for Two Groups of StatesHi, I am working on a project in which I have data from the CPS. I also have data that tells me when…
Creating missing value mechanismsHi, I would have a full dataset with an outcome variable y and a two predictors x1 and x2 and 100 o…
Stata 17- Percentages of the total sumHello Everyone, I have a list of individuals and their incomes. I have divided them into 5 quintiles…
Subscribe to:
Post Comments (Atom)
0 Response to Bin widths are not constant in histogram
Post a Comment