r package' ks'有Python版本吗?

发布于 2025-02-03 21:40:05 字数 363 浏览 3 评论 0原文

最近,我想比较两组积分,并找到了r软件包“ KS”。我需要的函数kde.test(基于内核密度的全局两样本比较测试,而不是KS测试)。例如

library(MASS)
data(crabs)
x1 <- crabs[crabs$sp=="B", c(4,6)]
x2 <- crabs[crabs$sp=="O", c(4,6)]
kt <- kde.test(x1=x1, x2=x2)

,但不幸的是,我对R不熟悉,我的大部分工作都是使用Python完成的,因此很难将脚本传输到R。同时,“ KS”(主要是KDE.test)的功能很重要我的工作。有人知道是否有Python版本的“ KS”,还是Python中具有类似功能的包装?

Recently I wanted to compare two sets of points and found the R package 'ks'. The function kde.test (a kernel density based global two-sample comparison test, not KS test) is what I need. For example

library(MASS)
data(crabs)
x1 <- crabs[crabs$sp=="B", c(4,6)]
x2 <- crabs[crabs$sp=="O", c(4,6)]
kt <- kde.test(x1=x1, x2=x2)

But unfortunately I'm not familiar in R and most of my work was done using Python, so it's hard to transfer my scripts to R. At the same time, the function of 'ks' (mainly kde.test) is important to my work. Does anyone know if there's a Python version of 'ks', or if there's a package with similar features in Python?

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

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

发布评论

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

评论(1

痴情换悲伤 2025-02-10 21:40:05

您可以使用 scipy> scipy python in Python。

执行(单样本或两样本)Kolmogorov-Smirnov测试
适合的好处。

单样本测试比较了A的基本分布F(x)
针对给定的分布G(x)样品。两样本测试比较
两个独立样本的基础分布。这两个测试
仅适用于连续分布。

You can use SciPy in Python.

Performs the (one-sample or two-sample) Kolmogorov-Smirnov test for
goodness of fit.

The one-sample test compares the underlying distribution F(x) of a
sample against a given distribution G(x). The two-sample test compares
the underlying distributions of two independent samples. Both tests
are valid only for continuous distributions.

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