See ?truehist in the MASS package.


Philipp Pagel wrote:
> 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
>

______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to