# st: RE: forcing stata densities to be within 1

 From "Nick Cox" <[email protected]> To <[email protected]> Subject st: RE: forcing stata densities to be within 1 Date Fri, 7 Jan 2005 17:10:19 -0000

```This problem is no problem. There is no
reason whatsoever to regard densities above
1 as pathological. They are densities,
not probabilities.

The following example occurs somewhere
in Stataland and is due to Ken Higbee.
Imagine a variable that is uniform on [0,1]
and (as always) its probability density
integrates to 1.
Geometrically on a histogram this is a square
with length 1 and area 1 and so necessarily height 1.

Now halve that variable. The distribution now
is a rectangle with length 0.5 and area 1 and so
necessarily height 2.

Alternatively, consider that a density is
generically "amount of stuff per unit of space".
In physics, density is amount of mass per unit
volume. In demography, population density
is amount of population per unit area. In statistics,
probability density is amount of probability per
unit length for intervals on the real line, or the
equivalent for bivariate or multivariate distributions.
Thus densities are _never_ dimensionless.

Nick
[email protected]

[email protected]

> Does anyone know how to make stata densities to be no more
> than 1?  Here is an
> example. I have two variables x  and y and want to compare
> their densities. So
> I do the following,
>
> a) kdensity x, nograph gen (x fx);
> b) kdensity y, nograph gen(fy) at(x);
>
> Then I want to do:
>
> c) line fx fy x, options.
>
> My problem is that in the data I am working with, I find that
> fy exceeds 1. How
> do I make fy to be no higher than 1?
>
> Would appreciate any hints?

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