Exemple #1
0
def test_johnsonsb(rnd, a, b, loc, scale):
    # johnsonSb random variate generator
    johnsonsb_dist = RVGs.JohnsonSb(a, b, loc, scale)

    # obtain samples
    samples = get_samples(johnsonsb_dist, rnd)

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

    print_test_results('JohnsonSb', samples, expectation=mean, variance=var)
Exemple #2
0
def test_fitting_johnson_sb():
    print("\nTesting Johnson Sb with a=10, b=5, loc=10, scale=100")
    dist = RVGs.JohnsonSb(a=10, b=5, loc=10, scale=100)
    print('  percentile interval: ', dist.get_percentile_interval(alpha=0.05))

    data = np.array(get_samples(dist, np.random))
    dict_ml_results = RVGs.JohnsonSb.fit_ml(data=data, fixed_location=10)

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

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