self.Normal=rFitDistr(data,'Normal')#It fits the normal distribution to the given data sample
exceptRRuntimeError:
returnNone#If it doesn't fit Return None
myDict={'type':'Normal','mean':self.Normal[0][0],'sd':self.Normal[0][1]}#Create a dictionary with keys the name of the distribution and its parameters
myDict={'distributionType':'Normal','aParameter':'mean','bParameter':'stdev','aParameterValue':self.Normal[0][0],'bParameterValue':self.Normal[0][1]}#Create a dictionary with keys distribution's and distribution's parameters names and the parameters' values
returnmyDict#If there is no Error return the dictionary with the Normal distribution parameters for the given data sample
defLognormal_distrfit(self,data):
...
...
@@ -54,7 +54,7 @@ class Distributions:
self.Lognormal=rFitDistr(data,'Lognormal')#It fits the Lognormal distribution to the given data sample
exceptRRuntimeError:
returnNone#If it doesn't fit Return None
myDict={'type':'Lognormal','logmean':self.Lognormal[0][0],'logsd':self.Lognormal[0][1]}#Create a dictionary with keys the name of the distribution and its parameters
myDict={'distributionType':'Lognormal','aParameter':'logmean','bParameter':'logsd','aParameterValue':self.Lognormal[0][0],'bParameterValue':self.Lognormal[0][1]}#Create a dictionary with keys distribution's and distribution's parameters names and the parameters' values
returnmyDict#If there is no Error return the dictionary with the Lognormal distribution parameters for the given data sample
#Set of if...elif syntax in order to get a Python dictionary with the best fitting statistical distribution and its parameters
iflist1[b]=='Normal':#Check if in list's b position is the Normal distribution
self.Normal_distrfit(data)
myDict={'type':list1[b],'aParameter':'mean','bParameter':'standarddeviation','aParameterValue':self.Normal[0][0],'bParameterValue':self.Normal[0][1]}#Create a dictionary with distribution's and distribution parameters' names and distribution parameters' values
myDict={'distributionType':list1[b],'aParameter':'mean','bParameter':'stdev','aParameterValue':self.Normal[0][0],'bParameterValue':self.Normal[0][1]}#Create a dictionary with distribution's and distribution parameters' names and distribution parameters' values