0

I am trying to find the best distribution to fit data.

This the code I have written. It generates a random sample of 100 normal random variables and uses the fitter module of Python to determine the best distribution. However, I want to add 2 parameter Weibull and 2 parameter Gamma distributions to the candidate distributions (currently they are both 3 parameter). How do you add 2-parameter Weibull and 2-parameter Gamma distributions to the list of candidate distributions named 'distributions'?

import numpy as np
import pandas as pd
import seaborn as sns
from fitter import Fitter, get_common_distributions, get_distributions
import numpy as np 

mu, sigma = 0, 0.1 # mean and standard deviation 
 
height = np.random.normal(mu, sigma, 100).tolist() 

f = Fitter(height,
           distributions=['weibull_max', 'weibull_min', 'gamma',
                          'lognorm', 
                          "beta", 
                          "burr", 
                          "norm"])
f.fit()

print(f.summary()) 

print("The best fitting distribution is: ", f.get_best(method = 'sumsquare_error'))
Progman
  • 16,827
  • 6
  • 33
  • 48
Andrew
  • 281
  • 3
  • 15

0 Answers0