def f_cdf(x, df1, df2): """ Gives the value of the Fisher cumulative density function for the given x (x must be in [0, inf))and the specified parameters of the Fisher distribution- df1 and df2 specify the degrees of freedom (d1 and d2 > 0). """ if df1 <= 0 or df2 <= 0: raise IncorrectInputError() index = df1*x/(df1*x+df2) A = functions.incomplete_beta_function(index, df1/2, df2/2) B = functions.beta_function(df1/2, df2/2) return A/B
def f_pdf(x, df1, df2): """ Gives the value of the Fisher probability density function for the given x (x must be in (0, inf))and the specified parameters of the Fisher distribution- df1 and df2 specify the degrees of freedom (d1 and d2 > 0). TODO: implement for x = 0! """ if df1 <= 0 or df2 <= 0: raise IncorrectInputError() A = math.pow(df1*x, df1) B = math.pow(df2, df2) C = math.pow(df1*x+df2, df1+df2) D = math.pow(A*B/C, 0.5) beta = functions.beta_function(df1/2, df2/2) return D/(x*beta)