Python Dunn Post Hoc Test same p-values

84 views Asked by At

I'm learning statistics and while playing with post hoc tests, I noticed that Dunn's test returns the same p-value twice. I tried a different data set and the error repeated itself.

import pandas as pd
from scipy.stats import kruskal
from scikit_posthocs import posthoc_dunn

data = {
    'Group': ['A', 'A', 'A', 'B', 'B', 'B', 'C', 'C', 'C'],
    'Values': [10, 15, 12, 18, 20, 22, 25, 28, 30]
}

df = pd.DataFrame(data)

statistic, p_value = kruskal(df[df['Group'] == 'A']['Values'],
                              df[df['Group'] == 'B']['Values'],
                              df[df['Group'] == 'C']['Values'])

print(f"Kruskal-Wallis p-value: {p_value}")

posthoc_results = posthoc_dunn(df, val_col='Values', group_col='Group', p_adjust='holm')

print("\nDunna's Test Results:")
print(posthoc_results)

And i get. Dunna's Test Results:

   A         B       C

A 1.000000 0.359425 0.021871

B 0.359425 1.000000 0.359425

C 0.021871 0.359425 1.000000

why the p-value in the comparison of A to B is the same as B to C

0

There are 0 answers