Пример #1
0
def test_johnsonsu(rnd, a, b, loc, scale):
    # johnsonSu random variate generator
    johnsonsu_dist = RVGs.JohnsonSu(a, b, loc, scale)

    # obtain samples
    samples = get_samples(johnsonsu_dist, rnd)

    # report mean and variance
    mean = scipy.johnsonsu.mean(a, b, loc, scale)
    var = scipy.johnsonsu.var(a, b, loc, scale)

    print_test_results('JohnsonSu', samples, expectation=mean, variance=var)
Пример #2
0
def test_fitting_johnson_su():

    print("\nTesting Johnson Su with a=2, b=3, loc=1, scale=4")
    dist = RVGs.JohnsonSu(a=2, b=3, loc=1, scale=4)
    print('  percentile interval: ', dist.get_percentile_interval(alpha=0.05))

    data = np.array(get_samples(dist, np.random))
    dict_ml_results = RVGs.JohnsonSu.fit_ml(data=data, fixed_location=1)

    print("  Fit:")
    print("    ML:", dict_ml_results)

    # plot the fitted distributions
    Plot.plot_johnson_su_fit(data=data,
                             fit_results=dict_ml_results,
                             title='Maximum Likelihood')