[R] hist and truehist

Peter Dalgaard p.dalgaard at biostat.ku.dk
Fri Nov 26 16:48:47 CET 2004


Gregor GORJANC <gregor.gorjanc at bfro.uni-lj.si> writes:

> Hello!
> 
> Up to now I have been using hist() to display the distributions.
> Howevere, I noteiced strange numbers on y (vertical) axis, if I used
> probability = T or freq = F option. I thought it is a bug and launched
> the R-bug system and found some posts on that matter. Brian Ripley
> responded to one, that one should look at truehist() for that. Ok I
> can use truehist() if I want to see the ratios or probabilities, but
> what is then the "density or probability" in hist()?

...

> truehist(mydata) # looks OK

And truehist(mydata, h=.5)?

It is a density estimate. The sum of the bar _areas_ should be 1. 

> sum(x$intensities * .5)
[1] 0.9999998


-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: (+45) 35327907




More information about the R-help mailing list