[R] Histogram
Achim Zeileis
Achim.Zeileis at wu-wien.ac.at
Tue May 25 12:58:01 CEST 2004
On Tue, 25 May 2004 12:27:40 +0200 Cristian Pattaro wrote:
> Dear all,
>
> I have a surprising problem with the representation of frequencies in
> a histogram.
>
> Consider, for example, the R code:
>
> b<-rnorm(2000,3.5,0.3)
> hist(b,freq=F)
>
> When I plotted the histogram, I expected that values in the y-axis
> (the probability) varied between 0 and 1. Instead, they varied within
> the range 0-1.3.
The y-axis gives the density not the probability!
And the density you are sampling from has
R> dnorm(3.5, mean = 3.5, sd = 0.3)
[1] 1.329808
so you shouldn't be surprised by this.
Z
> Have you got any suggestion for obtaining a correct graph with
> probability within the range 0-1?
>
> Thank you very much!
>
> Bests
> /Cristian/
>
> =============================================
> Cristian Pattaro
> =============================================
> Unit of Epidemiology & Medical Statistics
> Department of Medicine and Public Health
> University of Verona
>
> http://biometria.univr.it
> cristian at biometria.univr.it
> =============================================
>
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html
>
More information about the R-help
mailing list