如何在R中检查直方图是正确的吗?

发布于 2025-01-20 17:42:06 字数 339 浏览 3 评论 0原文

我有一个概率值的数据框架D,并尝试绘制其直方图。直方图的风浪管适用于这些概率值和-log10(d)。但是,直方图-LOG10(d)看起来错误,因为它在x轴上停止3.5左右。为什么这样?这是D的直方图

。 png“ alt =”输入图像说明在此处”>

,如果为-log10(d)

“在此处输入图像说明”

I have a data frame D of probability values and try to plot the histogram of it. The histogram bellows are for those probability values and for -log10(D). However, the histogram -log10(D) looks wrong because it stops in around 3.5 in x axes. Why is this the case? This is the histogram for D.

enter image description here

and this if for -log10(D)

enter image description here

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

祁梦 2025-01-27 17:42:07

您的向量d可以近似:

set.seed(123)

D <- 10^(-sample(seq(0, 3.5, length = 1000), 
                 prob = seq(300, 1, length = 1000),
                 replace = TRUE))

我们可以看到直方图看起来相似,x轴范围在0到1:

hist(D)

”

log10(d)的直方图-log10(d)也很相似:

hist(-log10(D))

“在此处输入图像描述”

X轴停止3.5的原因仅仅是因为您在D中没有小于10^( - 3.5)的值, 在我的示例中为0.0003162278

,我得到:

min(D)
#> [1] 0.0003715952

这意味着-log10(d)的最大值小于3.5:

max(-log10(D))
#> [1] 3.42993

Your vector D can be approximated with:

set.seed(123)

D <- 10^(-sample(seq(0, 3.5, length = 1000), 
                 prob = seq(300, 1, length = 1000),
                 replace = TRUE))

And we can see the histogram looks similar, with an x axis range between 0 and 1:

hist(D)

enter image description here

and the histogram of -log10(D) is also similar:

hist(-log10(D))

enter image description here

The reason why the x axis stops at 3.5 is simply because you have no values in D that are smaller than 10^(-3.5), which is 0.0003162278

In my example, I get:

min(D)
#> [1] 0.0003715952

which means that the maximum value of -log10(D) is less than 3.5:

max(-log10(D))
#> [1] 3.42993
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文