On Thu, Apr 27, 2006 at 10:48:39AM -0700, [EMAIL PROTECTED] wrote: > Hi All, > > I want to use "hist" to get the relative frequency plot. But the range of > ylab is greater than 1,which I think it should be less than 1 since it > stands for the probability. > > I'm confused. Could you please help me with it?
I was pretty confused by that, too at first. The solution is that freq=False cause hist to plot the DENSITY rather than frequency. And density is not necesssarily the same as relative frequency. Excerpt from ?hist: density: values f^(x[i]), as estimated density values. If 'all(diff(breaks) == 1)', they are the relative frequencies 'counts/n' and in general satisfy sum[i; f^(x[i]) (b[i+1]-b[i])] = 1, where b[i] = 'breaks[i]'. If you want relative distance try something like this: myhist = hist(x,breaks=52, plot=F) myhist$counts = myhist$counts / sum(myhist$counts) plot(myhist,main=NULL,border=TRUE,xlab="days",xlim=c(0,6),lty=2) Not exactly clean, though -- we are messing with the myhist object... cu Philipp -- Dr. Philipp Pagel Tel. +49-8161-71 2131 Dept. of Genome Oriented Bioinformatics Fax. +49-8161-71 2186 Technical University of Munich Science Center Weihenstephan 85350 Freising, Germany and Institute for Bioinformatics / MIPS Tel. +49-89-3187 3675 GSF - National Research Center Fax. +49-89-3187 3585 for Environment and Health Ingolstädter Landstrasse 1 85764 Neuherberg, Germany http://mips.gsf.de/staff/pagel ______________________________________________ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html