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

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

```See also the explanation in [R] kdensity.

Nick
[email protected]

> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]]On Behalf Of Nick Cox
> Sent: 07 January 2005 17:10
> To: [email protected]
> Subject: st: RE: forcing stata densities to be within 1
>
>
> 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/
>

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