Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/design-patterns/2.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
Python 为什么非标准化分布的scipy范数不同_Python_Scipy_Normal Distribution - Fatal编程技术网

Python 为什么非标准化分布的scipy范数不同

Python 为什么非标准化分布的scipy范数不同,python,scipy,normal-distribution,Python,Scipy,Normal Distribution,我有一个正态分布,平均值为71,方差为20.25。该示例取自“人头优先统计” 当我将正态分布标准化为零的平均值时,我得到了正确的结果,但是从我对scipy和正态分布的理解来看,对于非标准化分布,我应该得到相同的概率 from scipy.stats import norm import math # prints 0.539337742276 print(norm(71, 20.25).sf(69)) zscore = (69-71) / math.sqrt(20.25) print(nor

我有一个正态分布,平均值为71,方差为20.25。该示例取自“人头优先统计”

当我将正态分布标准化为零的平均值时,我得到了正确的结果,但是从我对scipy和正态分布的理解来看,对于非标准化分布,我应该得到相同的概率

from scipy.stats import norm
import math

# prints 0.539337742276
print(norm(71, 20.25).sf(69))

zscore = (69-71) / math.sqrt(20.25)
print(norm(0,1).sf(zscore))
# prints 0.671639356718

请注意,
norm
是用均值和标度参数化的,而不是用均值和平方标度参数化的。因此,

>>> from scipy.stats import norm
>>> norm(71, pow(20.25,0.5)).sf(69)
0.6716393567181147
>>> zscore = (69-71) / pow(20.25,0.5)
>>> norm(0,1).sf(zscore)
0.6716393567181147

请注意,
norm
是用均值和标度参数化的,而不是用均值和平方标度参数化的。因此,

>>> from scipy.stats import norm
>>> norm(71, pow(20.25,0.5)).sf(69)
0.6716393567181147
>>> zscore = (69-71) / pow(20.25,0.5)
>>> norm(0,1).sf(zscore)
0.6716393567181147