def test_friedman(): x = [[0, 0.1, 0.2, 0.3, 0.4, 0.5], [0, 0.1, 0.2, 0.3, 0.4, 0.5]] d = Distribution(x) output = friedman.friedman(d) assert output['arg0'] == ((10.76923076923077, 11), (0.0, (11, 0)))
def test_std(): x = [0, 0.1, 0.2, 0.3, 0.4, 0.5] d = Distribution(x) output = measure.std(d) assert output['arg0'] == 0.1707825127659933
def test_var(): x = [0, 0.1, 0.2, 0.3, 0.4, 0.5] d = Distribution(x) output = measure.var(d) assert output['arg0'] == 0.029166666666666664
def test_rank(): x = [0, 0.1, 0.2, 0.3, 0.4, 0.5] d = Distribution(x) output = measure.rank(d) assert len(output['arg0']) == 6
def test_skewness(): x = [0, 0.1, 0.2, 0.3, 0.4, 0.5] d = Distribution(x) output = measure.skewness(d) assert output['arg0'] == 5.804286057433026e-17
def test_min(): x = [0, 0.1, 0.2, 0.3, 0.4, 0.5] d = Distribution(x) output = measure.min(d) assert output['arg0'] == 0
def test_kurtosis(): x = [0, 0.1, 0.2, 0.3, 0.4, 0.5] d = Distribution(x) output = measure.kurtosis(d) assert output['arg0'] == -1.268571428571428
def test_friedman_with_posthoc(): x = [[0, 0.1, 0.2, 0.3, 0.4, 0.5], [0, 0.1, 0.2, 0.3, 0.4, 0.5]] d = Distribution(x) output = friedman.friedman_with_posthoc(d, axis=1) assert len(output['arg0'][0]) == 6 assert output['arg0'][1] == 5.331310596344878
def test_u_test(): x = [0, 0.1, 0.2, 0.3, 0.4, 0.5] y = [0.07, 0.14, 0.72, 0.32, 0.59, 0.43] d = Distribution(x, y) output = mann_whitney.u_test(d) assert output['arg0-arg1'] == (0, 0.18923879662233944) or output['arg0-arg1'] == (0, 0.3939393939393939)
def test_signed_rank(): x = [0, 0.1, 0.2, 0.3, 0.4, 0.5] y = [0.07, 0.14, 0.72, 0.32, 0.59, 0.43] d = Distribution(x, y) output = wilcoxon.signed_rank(d) assert output['arg0-arg1'] == (0, 0.15625)
def test_rank_sum(): x = [0, 0.1, 0.2, 0.3, 0.4, 0.5] y = [0.07, 0.14, 0.72, 0.32, 0.59, 0.43] d = Distribution(x, y) output = wilcoxon.rank_sum(d) assert output['arg0-arg1'] == (0, 0.3366683676100388)
def test_measure_pipeline(): def f(x): return True d = Distribution([0.1, 0.2]) output = wrappers.measure_pipeline(f, d) assert output['arg0'] == True
def test_plot_critical_difference(): x = [0, 0.1, 0.2, 0.3, 0.4, 0.5] y = [0.07, 0.14, 0.72, 0.32, 0.59, 0.43] d = Distribution(x, y) friedman_nemenyi = friedman.friedman_with_posthoc(d) critical.plot_critical_difference(friedman_nemenyi)
def test_plot_h_index(): x = [0, 0.1, 0.2, 0.3, 0.4, 0.5] y = [0.07, 0.14, 0.72, 0.32, 0.59, 0.43] z = [2.17, 9.14, 999.72, 8.32, 7.19, 9.43] d = Distribution(x, y, z) signed_rank = wilcoxon.signed_rank(d) significance.plot_h_index(signed_rank)
def test_statistical_pipeline(): def f(x, y): return [0, 0] d = Distribution([0.1, 0.2], [0.3, 0.4]) alpha = 0.05 output = wrappers.statistical_pipeline(f, d, alpha) assert output['arg0-arg1'] == (1, 0)
import statys.plotters.significance as s import statys.tests.wilcoxon as w from statys.core import Distribution # Defining input arguments x = [0, 0.1, 0.2, 0.3, 0.4, 0.5] y = [0.07, 0.14, 0.72, 0.32, 0.59, 0.43] z = [2.17, 9.14, 999.72, 8.32, 7.19, 9.43] # Creating the distribution d = Distribution(x, y, z) # Calculating Wilcoxon's signed-rank test signed_rank = w.signed_rank(d) # Plots the p-values s.plot_p_value(signed_rank, title='Wilcoxon Signed-Rank Test ($p$-values)')