在 R 中绘制数据集的 CDF?数据、CDF

2023-09-06 04:57:57 作者:余音未散

我不太确定 CDF(累积分布函数)和 ECDF(经验累积分布函数)之间的区别,但我通常使用 CDF 图来观察我的数据.

I am not really sure about the difference between CDF (Cumulative Distribution Function) and ECDF (Empirical Cumulative Distribution Function) but I usually utilize a CDF plot to make observations about my data.

我最近一直在使用 R,并且非常想知道如何绘制我的数据的 CDF 和 CCDF(互补 CDF).我所能找到的只是 R 有 ecdf 但我不确定这是否是我正在寻找的.绘制 ECDF 非常简单:

I have been using R recently and am desperately trying to find out how to plot a CDF and CCDF (Complementary CDF) of my data. All I could find was that R has ecdf but am not really sure if this is what I am looking for. Plotting an ECDF is as simple as:

plot.ecdf(data)

有谁知道如何使用 R 绘制数据集的 CDF 和 CCDF?

Does anyone know how to plot a CDF and CCDF of a dataset using R?

推荐答案

当您知道或假设分布时,CDF 通常需要封闭形式.另一方面,ECDF 是经验的",因为它来自您的数据.我刚刚回答了一个关于使用 ecdf() 和 Hmisc 的 Ecdf() 在这里 前几天.

A CDF commonly requires closed form when you know or assume a distribution. An ECDF, on the other hand, is 'empiricial' as it comes from your data. I just answered a question about using ecdf() and Hmisc's Ecdf() here the other day.

更一般地说,您可以在这里使用诸如

More generally, you can search here using terms such as

 [r] ecdf

在搜索框中查找 R 标签中的ecdf".在 rseek.org,'ccdf' 很少出现.这可能与减去 ECDF 的值相同吗?如果是这样,Hmisc 中的 Ecdf() 可以做到.

in the search box to look for 'ecdf' within the R tag. At rseek.org, little comes up for 'ccdf'. Is that maybe just the same as one minus the ECDF? If so, Ecdf() in Hmisc can do it.

我希望这会有所帮助,如果没有,请重新表述您的问题,因为您不太清楚您在寻找什么.ecdf()Ecdf() 都非常有特色,所以一定要阅读他们的帮助页面.

I hope this helps, if not please re-phrase your question as it is not quite clear exactly what you are looking for. Both ecdf() and Ecdf() are pretty featureful so make sure to read their help pages.