假设我有这个数组 A:
array([ 0.0019879 , -0.00172861, -0.00527226, 0.00639585, -0.00242005,
-0.00717373, 0.00371651, 0.00164218, 0.00034572, -0.00864304,
-0.00639585, 0.006828 , 0.00354365, 0.00043215, -0.00440795,
0.00544512, 0.00319793, 0.00164218, 0.00025929, -0.00155575,
0.00129646, 0.00259291, -0.0039758 , 0.00328436, 0.00207433,
0.0011236 , 0.00440795, 0.00164218, -0.00319793, 0.00233362,
0.00025929, 0.00017286, 0.0008643 , 0.00363008])
如果我运行:
np.histogram(A, bins=9, density=True)
根据历史记录获得以下信息:
array([ 34.21952021, 34.21952021, 34.21952021, 34.21952021,
34.21952021, 188.20736116, 102.65856063, 68.43904042,
51.32928032])
手册上说:
"If True, the result is the value of the probability density function at the bin, normalized such that the integral over the range is 1. Note that the sum of the histogram values will not be equal to 1 unless bins of unity width are chosen; it is not a probability mass function."
我认为我对直方图和密度函数有很好的理解,但我真的不明白这些值代表什么或如何计算它们。
我需要用R重现这些值,因为我正在两种语言之间移植一些代码。