为什么python和R在计算CV的结果上有区别?

时间:2019-05-08 21:24:50

标签: python r variations coefficients

计算变异系数非常基本。在edx-python课程中,我偶然发现了一个用python计算CV的问题。我以为R会更快,但是答案是错误的。

我实际上感兴趣的是哪一个更正确?

Python:

from scipy.stats import variation
cvtest = [10, 4, 12, 15, 20, 5]
variation(cvtest)
# Answer: 0.5034317492677621 - answer was accepted 

R:

cvtest = c(10, 4, 12, 15, 20, 5)
sd(cvtest)/mean(cvtest)
# Answer: 0.5514819 - answer was not accepted

0 个答案:

没有答案