From be1f0aa78463f50bb58285419810f90457fdd705 Mon Sep 17 00:00:00 2001 From: Andreas Tsouchlos Date: Tue, 11 Mar 2025 17:47:59 +0100 Subject: [PATCH] Add hypothesis test scripts --- scripts/perform_hypothesis_tests.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 scripts/perform_hypothesis_tests.py diff --git a/scripts/perform_hypothesis_tests.py b/scripts/perform_hypothesis_tests.py new file mode 100644 index 0000000..252a7e5 --- /dev/null +++ b/scripts/perform_hypothesis_tests.py @@ -0,0 +1,28 @@ +from scipy.stats import mannwhitneyu +import pandas as pd +import numpy as np + + +filename_left = "res/flowrate_left.csv" +filename_right = "res/flowrate_right.csv" +filename_both = "res/flowrate_both.csv" + + +def main(): + df_left = pd.read_csv(filename_left) + flowrate_left = np.array(df_left["flowrate"]) + + df_right = pd.read_csv(filename_right) + flowrate_right = np.array(df_right["flowrate"]) + + df_both = pd.read_csv(filename_both) + flowrate_both = np.array(df_right["flowrate"]) + + U_lr, p_lr = mannwhitneyu(flowrate_left, flowrate_both, method="exact") + U_rb, p_rb = mannwhitneyu(flowrate_right, flowrate_both, method="exact") + + print(f"Left-Right: p = {p_lr}") + print(f"Right-Both: p = {p_rb}") + +if __name__ == "__main__": + main()