计算数组的第三个标准偏差
Calculate the 3rd standard deviation for an array
说,我有一个数组:
import numpy as np
x = np.array([0, 1, 2, 5, 6, 7, 8, 8, 8, 10, 29, 32, 45])
我如何计算它的第 3 个标准偏差,这样我就可以得到 +3sigma
的值,如下图所示?
通常,我使用 std = np.std(x)
,但老实说,我不知道它是 returns 1sigma
值还是 2sigma
,或者其他什么。我会非常感谢你的帮助。提前谢谢你。
NumPy 的 std
产生标准偏差,通常用 "sigma" 表示。要获得 2-sigma 或 3-sigma 范围,您可以简单地将 sigma 乘以 2 或 3:
print [x.mean() - 3 * x.std(), x.mean() + 3 * x.std()]
输出:
[-27.545797458510656, 52.315028227741429]
有关更详细的信息,您可以参考文档,其中指出:
The standard deviation is the square root of the average of the
squared deviations from the mean, i.e., std = sqrt(mean(abs(x -
x.mean())**2)).
http://docs.scipy.org/doc/numpy/reference/generated/numpy.std.html
说,我有一个数组:
import numpy as np
x = np.array([0, 1, 2, 5, 6, 7, 8, 8, 8, 10, 29, 32, 45])
我如何计算它的第 3 个标准偏差,这样我就可以得到 +3sigma
的值,如下图所示?
通常,我使用 std = np.std(x)
,但老实说,我不知道它是 returns 1sigma
值还是 2sigma
,或者其他什么。我会非常感谢你的帮助。提前谢谢你。
NumPy 的 std
产生标准偏差,通常用 "sigma" 表示。要获得 2-sigma 或 3-sigma 范围,您可以简单地将 sigma 乘以 2 或 3:
print [x.mean() - 3 * x.std(), x.mean() + 3 * x.std()]
输出:
[-27.545797458510656, 52.315028227741429]
有关更详细的信息,您可以参考文档,其中指出:
The standard deviation is the square root of the average of the squared deviations from the mean, i.e., std = sqrt(mean(abs(x - x.mean())**2)).
http://docs.scipy.org/doc/numpy/reference/generated/numpy.std.html