0

I'm developing a system in Python that returns a specific number given a needed probability in a statistic curve

My dataset contains each value of this variable that I call "data". First I get this values and show the histogram of it

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

After the histogram I fit it to the best curve

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

parameters from get_best = {'invweibull': (2.2940157, -3.159848, 17.021271)}

Now I get all parameters about the specific curve (in this case invweibull) What I need now is to give a probability number (example 95%) and the system retrieve me the number that it represents. In this exemple, the 50.35

The number of 95% probability is 50.35

How can I get this number given a probability?

Flavio Amadio
  • 35
  • 1
  • 6
  • Have you looked at the `fitter.get_best()` method? Apparently it returns the parameters of the best fitted distribution. See [documentation](https://fitter.readthedocs.io/en/latest/references.html#fitter.fitter.Fitter.get_best) – Bill May 12 '20 at 17:09
  • Hi Bill. I got the parameters using the get_best but I want to khow how to use them to get the spefic number. With these parameters I could just redraw the curve. How do I use them to get the value? – Flavio Amadio May 12 '20 at 20:10

1 Answers1

0

This is dist.ppf(0.95, *fit_result).

ev-br
  • 24,968
  • 9
  • 65
  • 78