简体   繁体   English

R package 'ks' 是否有 Python 版本?

[英]Does R package 'ks' have a Python version?

Recently I wanted to compare two sets of points and found the R package 'ks'.最近想比较两组点数,发现R package 'ks'。 The function kde.test (a kernel density based global two-sample comparison test, not KS test) is what I need.我需要的是 function kde.test(基于 kernel 密度的全局双样本比较测试,而不是 KS 测试)。 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.但不幸的是我对R并不熟悉,我的大部分工作都是使用Python完成的,所以我的脚本很难转移到R。同时'ks'的function(主要是kde.test)对我很重要工作。 Does anyone know if there's a Python version of 'ks', or if there's a package with similar features in Python?有谁知道'ks'是否有Python版本,或者Python中是否有具有类似功能的package?

You can use SciPy in Python.可以在Python中使用SciPy

Performs the (one-sample or two-sample) Kolmogorov-Smirnov test for goodness of fit.对拟合优度执行(一个样本或两个样本)Kolmogorov-Smirnov 检验。

The one-sample test compares the underlying distribution F(x) of a sample against a given distribution G(x).单样本检验将样本的基础分布 F(x) 与给定分布 G(x) 进行比较。 The two-sample test compares the underlying distributions of two independent samples.双样本检验比较两个独立样本的基本分布。 Both tests are valid only for continuous distributions.这两个测试仅对连续分布有效。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM