Advertisement
elena1234

Friedman test for paired data and Post-Hoc tests

Jul 22nd, 2022
1,050
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.60 KB | None | 0 0
  1. test_stat,p_value = stats.friedmanchisquare(method_A,method_B, method_C)
  2. print("p value:%.4f" % p_value)
  3.  
  4. Note: Since the data is not normal, the nonparametric version of the posthoc test is used.
  5. data = np.array([method_A, method_B, method_C])
  6. posthoc_df=sp.posthoc_wilcoxon(data, p_adjust="holm")
  7. # posthoc_df = sp.posthoc_nemenyi_friedman(data.T) ## another option for the posthoc test
  8.  
  9. group_names= ["Method A", "Method B","Method C"]
  10. posthoc_df.columns= group_names
  11. posthoc_df.index= group_names
  12. posthoc_df.style.applymap(lambda x: "background-color:violet" if x<0.05 else "background-color: white")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement