From eairoldi at Princeton.EDU  Wed Feb 14 23:51:50 2007
From: eairoldi at Princeton.EDU (Edo Airoldi)
Date: Wed, 14 Feb 2007 17:51:50 -0500
Subject: [Rd] Problem with the 'hist' function
Message-ID: <7B7F2C3E-07D7-44ED-A7E7-06E97CCB702E@princeton.edu>

Hi, I am using the following R version:

 > R version 2.4.1 (2006-12-18)
 > Copyright (C) 2006 The R Foundation for Statistical Computing
 > ISBN 3-900051-07-0

  I believe I found a bug in the 'hist' function, when  
'probability=TRUE'. I looked in the archives and I came across  
problems with the 'hist' functions (e.g., bug PR# 944, posted in  
2001), however, a quick search did not find the exact problem I a  
found. A brief description of the issue follows.

 > z<-rnorm(10)
 > z
[1]  0.51649608 -0.20676010  0.65951365  0.46733006  0.02084361   
0.18323525
[7] -0.21522566  0.29597667  0.81549448  0.26252625
 > hist(z,breaks=seq(-1,1,by=.25))
 > hist(z,breaks=seq(-1,1,by=.25),probability=TRUE)

  I think the values on the Y axis are messed up, e.g., it should top  
at 0.3 (relative frequency) for the bin [0.25 0.50). How is 'Density'  
computed?

best regards,
Edo


-------------------------------------------------
  Edo Airoldi, Ph.D.

  Department of Computer Science  &
  Lewis-Sigler Institute for Integrative Genomics
  Princeton University, NJ 08544

  609-258-8326 (lab phone)  609-258-8004 (fax)



[Rd] Problem with the 'hist' function
Edo Airoldi