[R] Why using hist when setting the parameter probability=TRUE does not create probability plot?

Duncan Murdoch murdoch.duncan at gmail.com
Tue Jan 22 00:28:32 CET 2013

On 13-01-21 5:18 PM, hp wan wrote:
> Hi All,
> When carrying out hist(samples,breaks=50,probability=TRUE), the column
> values are considerably greater than 1, which seams very unreasonable. The
> plot is attached.
> I think the column value of the hist plot should correspond to
> x$counts/sum(x$counts)
>     (x=hist(samples,breaks=50,probability=TRUE)). The size of data is a
> little bit larger,  causing failure of uploading. If you need the data, I
> can email it to you.
> Can anyone help me?

I think you need to reread the documentation.  It is a "probability 
density" plot, not a "probability plot."  You need to integrate the 
values to get probabilities.  Probability density functions can be 
bigger than 1 as long as they integrate to 1.

Duncan Murdoch

> Thanks!
> Best regares,
> Huaping Wan
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

More information about the R-help mailing list