为什么 SciPy 中的 Gamma 分布有三个参数? [英] Why does the Gamma distribution in SciPy have three parameters?
问题描述
通常,Gamma 分布有两个参数:形状和尺度(或者形状和速率).然而,在 SciPy 中,Gamma 分布似乎具有三个参数:两个形状参数和一个位置参数.
Usually, the Gamma distribution has two parameters: shape and scale (or alternatively shape and rate). However, it seems that in SciPy the Gamma distribution has three parameters: two shape parameters and a location parameter.
有谁知道 Gamma 的 SciPy 参数之间的映射,例如维基百科上给出的定义中的参数:
Does anyone know the mapping between the SciPy parameters of Gamma, and, e.g., the parameters in the definition given on wikipedia:
http://en.wikipedia.org/wiki/Gamma_distribution
谢谢!
推荐答案
所有 scipy.stats 中的连续分布都有位置和尺度参数,即使是那些通常不使用位置的参数.对于 gamma 分布,只需将位置保留为其默认值 0.如果您使用 fit
方法,请使用参数 floc=0
以确保它不会处理位置作为自由参数.
All the continuous distributions in scipy.stats have location and scale parameters, even those for which the location is not generally used. For the gamma distribution, just leave the location at its default value 0. If you are using the fit
method, use the argument floc=0
to ensure that it does not treat the location as a free parameter.
scipy gamma 分布中的形状和尺度参数分别对应于维基百科页面中的 k 和 theta.
The shape and scale parameters in the scipy gamma distribution correspond to k and theta, respectively, in the wikipedia page.
这篇关于为什么 SciPy 中的 Gamma 分布有三个参数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!