[R] Re : sum(hist$density) == 2 ?!
Pascal Oettli
kridox at ymail.com
Wed Mar 14 06:52:58 CET 2012
Hi Sam,
?hist gives:
"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]."
1st case, density != frequency because all(diff(breaks) == 1) is FALSE (diff = 0.5); sum(h$density*diff) = 1
2nd case, density == frequency because all(diff(breaks) == 1) is TRUE (diff = 1); sum(h$density*diff) = 1
Regards,
Pascal
--
Sam Steingold (http://sds.podval.org/) on Ubuntu 11.10 (oneiric) X 11.0.11004000
http://www.childpsy.net/ http://www.memritv.org http://openvotingconsortium.org
http://thereligionofpeace.com http://mideasttruth.com http://palestinefacts.org
((lambda (x) `(,x ',x)) '(lambda (x) `(,x ',x)))
______________________________________________
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