Python scipy.stats获取invweibull曲线上特定概率的数字

2024-06-01 08:05:06 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在用Python开发一个系统,在统计曲线中给定所需的概率后,返回一个特定的数字

我的数据集包含这个变量的每个值,我称之为“数据”。 首先我得到这个值并显示它的直方图

import pandas as pd
from scipy import stats
from fitter import Fitter

data = pd.read_csv("124_2.csv", encoding='ISO-8859-1',sep=';',decimal=',') 

plt.hist(data)
plt.show()

pareto distribution of data

在直方图之后,我将其拟合到最佳曲线

dist_names = ['rayleigh', 
             'pareto',
             'exponnorm',
             'alpha',
             'loggamma',
             'lognorm',
             'laplace',
             'beta',
             'expon',
             'gamma',
             'lognorm',
             'norm',
             'pearson3',
             'triang',
             'uniform',
             'weibull_min',
             'weibull_max',
             'invweibull']

f = Fitter(data)
f.fit()
f.summary()
f.get_best(method='sumsquare_error')

Data fitted to the best curve

来自get_best的参数={'invweibull':(2.2940157,-3.159848,17.021271)}

现在我得到了关于特定曲线的所有参数(在本例中为invweibull) 我现在需要的是给出一个概率数(例如95%),然后系统检索它所代表的数字。在本例中,50.35

The number of 95% probability is 50.35

在给定概率的情况下,我如何得到这个数字


Tags: csv数据fromimportdata系统plt数字