q不是scipy的genextreme distribution的参数。它是方法ppf(cdf 的倒数)和isf(生存函数的倒数)的参数。如果您查看其他发行版的文档 - 例如norm、gamma--您会看到所有类级别的文档字符串在其“参数”中列出了 q,但该文档是对所有方法的参数的概述。 genextreme 具有标准的位置和比例参数,以及一个形状参数,c。
例子:
>>> genextreme.cdf(genextreme.ppf(0.95, c=0.5), c=0.5)
0.94999999999999996
您可以找到有关generalized extreme distribution on wikipedia 的更多信息,但请注意,scipy 中使用的 shape 参数与维基百科文章中的 shape 参数的符号相反。例如,以下生成维基百科图:
import numpy as np
import matplotlib.pyplot as plt
from scipy.stats import genextreme
# Create the wikipedia plot.
plt.figure(1)
x = np.linspace(-4, 4, 201)
plt.plot(x, genextreme.pdf(x, 0.5), color='#00FF00', label='c = 0.5')
plt.plot(x, genextreme.pdf(x, 0.0), 'r', label='c = 0')
plt.plot(x, genextreme.pdf(x, -0.5), 'b', label='c = -0.5')
plt.ylim(-0.01, 0.51)
plt.legend(loc='upper left')
plt.xlabel('x')
plt.ylabel('Density')
plt.title('Generalized extreme value densities')
plt.show()
结果:
当cloc + scale / c。下面创建了带有c = -0.25、scale = 5 和loc = -scale / c 的分布图(因此支持的左端位于 0):
c = -0.25
scale = 5
loc = -scale / c
x = np.linspace(0, 80, 401)
pdf = genextreme.pdf(x, c, loc=loc, scale=scale)
plt.plot(x, pdf)
plt.xlabel('x')
plt.ylabel('Density')
剧情:
scipy 文档站点上的stats tutorial 提供了有关分发类的更多信息,包括关于shifting and scaling a distribution 的部分。