在 R 中生成概率分布函数 (PDF) 的问题
您好,我正在使用 R 来分析模拟输出的数据。我正在使用 hist 函数生成 pdf,我给出的确切命令是
hist(data_delay$delay,freq=F)
根据我的理解,图表 y 轴的值应小于 1,Y 轴上的所有计数应加起来为 1。但不幸的是,我没有得到Y 轴的随机范围,有时值为 1000。
我附上我的示例输入文件。在此,Y 轴值的范围为 0 到 100。
感谢您提供的所有帮助。
Hi I am using R to analyze data from output of my simulation. I am using hist function to generate pdf's the exact command i give is
hist(data_delay$delay,freq=F)
In my understanding the values the y axis of the chart should be less then 1, all the counts on Y-Axis should add up to 1. But unfortunately I am not getting random range at Y-Axis, sometimes values in 1000's.
I am attaching my sample input file. In this the Y-Axis values are in the range of 0 to 100.
Thank you for all the help you can provide.
My data is as follows
http://www.mediafire.com/?twyoseg8bai0dr7
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
![扫码二维码加入Web技术交流群](/public/img/jiaqun_03.jpg)
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
根据
hist
文档,当freq=FALSE
时,“直方图的总面积为 1”。它并没有说每个条形的高度应该小于一。使用命令和数据创建的直方图的总面积确实为 1。断点的间距相等为 0.005,因此我们可以通过执行以下操作来查看直方图中的总面积。
According to the
hist
documentation, whenfreq=FALSE
, "the histogram has a total area of one". It does not say that the height of every bar should be less than one. The histogram created with your command and data does have a total area of 1.The breaks are equally spaced 0.005 apart, so we can see the total area in the histogram by doing the following.
您可能更喜欢
?密度
如
foo<-密度(rnorm(1000));绘图(foo)
You might prefer
?density
as in
foo<-density(rnorm(1000)) ; plot(foo)