[R] Questions about histograms

From: Andre Nathan <andre_at_digirati.com.br>
Date: Sun, 10 Feb 2008 23:14:28 -0200


I'm doing some experiments with the various histogram functions and I have a two questions about the "prob" option and binning.

First, here's a simple plot of my data using the default hist() function:

> hist(data[,1], prob = TRUE, xlim = c(0, 35))


My first question is regarding the resulting plot from hist.scott() and hist.FD(), from the MASS package. I'm setting prob to TRUE in these functions, but as it can be seen in the images below, the value for the first bar of the histogram is well above 1.0. Shouldn't the total area be 1.0 in the case of prob = TRUE?

> hist.scott(data[,1], prob = TRUE, xlim=c(0, 35))


> hist.FD(data[,1], prob = TRUE, xlim=c(0, 35))


Is there anything I can do to "fix" these plots?

My second question is related to binning. Is there a function or package that allows one to use logarithmic binning in R, that is, create bins such that the length of a bin is a multiple of the length of the one before it?

Pointers to the appropriate docs are welcome, I've been searching for this and couldn't find any info.

Best regards,

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. Received on Mon 11 Feb 2008 - 01:25:23 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 11 Feb 2008 - 02:30:14 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive