def test_geometric(rnd, p, loc=0): # geometric random variate generator geometric_dist = RVGs.Geometric(p, loc) # obtain samples samples = get_samples(geometric_dist, rnd) # report mean and variance print_test_results('Geometric', samples, expectation=1 / p + loc, variance=(1 - p) / (p**2))
dist = RVGs.Gamma(10, 1, 2) dat_gamma = np.array(get_samples(dist, np.random)) # generate data dictResults = Fit.fit_gamma(dat_gamma, 'Data', fixed_location=1) # fit print("Fitting Gamma:", dictResults) # 7 GammaPoisson dist = RVGs.GammaPoisson(a=2, gamma_scale=4, loc=1, scale=2) dat_gamma_poisson = np.array(get_samples(dist, np.random)) dictResults = Fit.fit_gamma_poisson(dat_gamma_poisson, 'Data', fixed_location=1, fixed_scale=2) # fit print("Fitting GammaPoisson:", dictResults) # 8 Geometric dist = RVGs.Geometric(0.3, 1) dat_geom = np.array(get_samples(dist, np.random)) # generate data dictResults = Fit.fit_geometric(dat_geom, 'Data', fixed_location=1) # fit print("Fitting Geometric:", dictResults) # 9 fitting a JohnsonSb distribution dist = RVGs.JohnsonSb(a=10, b=3, loc=1, scale=2) dat_JohnsonSb = np.array(get_samples(dist, np.random)) # generate data dictResults = Fit.fit_johnsonSb(dat_JohnsonSb, 'Data', fixed_location=1) # fit print("Fitting johnsonSb:", dictResults) # 10 fitting a JohnsonSu distribution dist = RVGs.JohnsonSu(a=10, b=3, loc=1, scale=2) dat_JohnsonSu = np.array(get_samples(dist, np.random)) # generate data dictResults = Fit.fit_johnsonSu(dat_JohnsonSu, 'Data', fixed_location=1) # fit print("Fitting johnsonSu:", dictResults)