Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/vim/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Statistics Scipy stat(KS测试)分布与数据集的直方图不匹配_Statistics_Data Science_Distribution_Scipy.stats - Fatal编程技术网

Statistics Scipy stat(KS测试)分布与数据集的直方图不匹配

Statistics Scipy stat(KS测试)分布与数据集的直方图不匹配,statistics,data-science,distribution,scipy.stats,Statistics,Data Science,Distribution,Scipy.stats,我有一个这样的数据集 y = array([ 25., 20., 10., 31., 30., 66., 13., 5., 9., 2., 4., 9., 6., 26., 72., 7., 5., 18., 8., 12., 4., 7., 114., 5., 6., 17., 39., 4., 5., 42., 63., 3., 6., 16., 17., 4., 27

我有一个这样的数据集

y = array([ 25.,  20.,  10.,  31.,  30.,  66.,  13.,   5.,   9.,   2.,   4.,
     9.,   6.,  26.,  72.,   7.,   5.,  18.,   8.,  12.,   4.,   7.,
   114.,   5.,   6.,  17.,  39.,   4.,   5.,  42.,  63.,   3.,   6.,
    16.,  17.,   4.,  27.,  18.,   3.,   7.,  48.,  24.,  72.,  21.,
    12.,  13., 106., 120.,   5.,  34.,  52.,  22.,   2.,   8.,   9.,
     5.,  35.,   4.,   4.,   1.,  56.,   1.,  17.,  34.,   3.,   5.,
    17.,  17.,  10.,  48.,   9., 195.,  20.,  60.,   5.,  77., 114.,
    59.,   1.,   1.,   1.,  67.,   9.,   4.,   1.,  13.,   6.,  46.,
    40.,   8.,   6.,   1.,   2.,   1.,   1.,   1.,   7.,   6.,  53.,
     6.,   3.,   4.,   2.,   1.,   1.,   5.,   1.,   5.,   1.,   7.,
     1.,   1.])
该数据对应的直方图如下所示

number_of_bins = len(y)
bin_cutoffs = np.linspace(np.percentile(y,0), np.percentile(y,99),number_of_bins)
h = plt.hist(y, bins = bin_cutoffs, color='red')

我使用以下代码测试数据集以从scipy stat KS test获取实际参数(从以下代码获取)

结果表明,它的基因最大分布。结果如下所示:

('genextreme',
0.1823402997669471,
(-1.119997717132149, 5.036499415233003, 6.2122664378291175))
使用这些属性拟合的曲线如下所示


根据我的理解,柱状图表明这是一个指数分布。但从KS测试来看,它显示了另一个。有人能解释为什么会发生这种情况或任何错误吗?

我敢说,扼杀指数的是y>=100的几个异常值。基本上,K-S在这些值上存在巨大的CDF差异。广义极值分布,我猜,总体上有一点缓和的PDF下降。我敢说,在y>=100时,有几个异常值会破坏指数。基本上,K-S在这些值上存在巨大的CDF差异。广义极值分布,我猜,在很大程度上有一点缓和的PDF下降
('genextreme',
0.1823402997669471,
(-1.119997717132149, 5.036499415233003, 6.2122664378291175))