Python matlab 中 wblinv 的对应部分

Python counter part of wblinv in matlab

我正在尝试将 matlab 代码转换为 python 代码。 我陷入的是逆威布尔函数部分。 因此,matlab 代码如下:

p = 0.9978
scale_param = 3.5666
shape_param = 0.4936
wblinv(p, scale_param, shape_param)

wblinv 给出了对应于 cdf 的分位数 p 的值,上面的结果给出了 139.9775。

我搜索了一下发现scipy提供了weibull分布函数。 我想 scipy.stats.invweibull.cdf 函数会做同样的操作。但结果却截然不同。

from scipy import stats
p = 0.9978
scale_param = 3.5666
shape_param = 0.4936
stats.invweibull.cdf(p, shape_param, scale=scale_param)

它给出了 abt。 0.153312

任何建议都会有所帮助。

Matlab函数wblinv computes the inverse cumulative distribution function for a Weibull distribution. The corresponding distribution in scipy that you want is scipy.stats.weibull_min, and the method to compute the inverse of the CDF (also known as the percent point function or the quantile function) is scipy.stats.weibull_min.ppf. The distribution scipy.stats.invweibull是不同的概率分布

例如,

In [10]: from scipy import stats

In [11]: p = 0.9978

In [12]: scale_param = 3.5666

In [13]: shape_param = 0.4936

In [14]: stats.weibull_min.ppf(p, shape_param, scale=scale_param)
Out[14]: 139.97751836430132