# st: RE: Specifying how to center bins and what points to use as estimates in histograms and kernel densities

 From "Nick Cox" To Subject st: RE: Specifying how to center bins and what points to use as estimates in histograms and kernel densities Date Sun, 16 Jul 2006 16:54:14 +0100

```I think you can ensure that one bin is centred on zero
by using the -start()- and -width()- options of -histogram-.
However, -start()- must be at or below the minimum value
for this to work as you want.

A similar comment applies to kernel density estimation.
You might find the -range- command useful.

In either case, a little mental arithmetic may be necessary.
So if I go

... , start(-0.025) width(0.01)

I ensure than one bin is from -0.005 to 0.005.

Nick
n.j.cox@durham.ac.uk

Aimée R. Dechter
>
>   I would like to analyze the univariate distribution of a continuous
> variable where the vast majority of observations have a single value,
> zero. I would be grateful for advice on how to handle the bins of the
> histograms and kernel density estimates that I am graphing.
> Specifically I
> would like to find out how I can ensure two things: 1) that
> Stata always
> uses the value 0 for one of its point estimates, and 2) that
> Stata always
> create bins, such that the bin that includes the value 0 will
> always be
> centered around 0. Both restrictions are especially important when
> comparing the histograms and kernel density across sub-populations. I
> would be very grateful for any information on how I might be
> able to do
> these two things.
>
>  FYI: The minimum value for the continuous variable is less
> than zero and
> the maximum is greater than zero. I am looking at the univariate
> distribution of several variables, including the absolute difference
> between two continuous measures, the ratio, the log of the ratio, the
> proportionate difference, etc., and trying to see how the
> distributions of
> each of these variables differ between two or more subpopulations.

*
*   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/
```