s-news
[Top] [All Lists]

[S] Histograms.

To: s-news@wubios.wustl.edu
Subject: [S] Histograms.
From: Rolf Turner <rolf@math.unb.ca>
Date: Sun, 31 Oct 1999 14:34:24 -0400 (AST)
Sender: owner-s-news@wubios.wustl.edu

In response to a question from Kin Cheung, Albyn Jones writes:

>  a histogram, or in general a density does not have to be bounded 
>  by 1, the total area has to be 1.  Consider for example the normal
>  with small standard deviation:
>  
>  > dnorm(0,0,.001)
>  [1] 398.9423

All very true, but I think the argument name ``probability'' in
hist() is misleading.  If I set ``probability = T'' I'd expect to get
probabilities, numbers in the range 0 to 1.  In other words, what the
elementary stats texts call a ``relative frequency'' histogram.
(Admittedly the documentation for hist() does indeed make it clear
--- if one reads it --- that one is getting a p.d.f. and not relative
frequencies.)

If the histogram is to be thought of as a probability ***density***
function, the argument should ``say so'' --- i.e. the argument should
be ``probability.density = T''.  Or, perhaps to shorten things down,
``pdf = T''.

One does, from time to time, want ``relative frequency'' histograms;
it would be nice if hist() provided a facility for this.  As things
stand, one has to modify the code of hist() locally, or fiddle about
with barplot().  Neither is difficult to do, but it's a mild pain
in the pohutukawa.

                                        Rolf Turner
                                        rolf@math.unb.ca
-----------------------------------------------------------------------
This message was distributed by s-news@wubios.wustl.edu.  To unsubscribe
send e-mail to s-news-request@wubios.wustl.edu with the BODY of the
message:  unsubscribe s-news

<Prev in Thread] Current Thread [Next in Thread>