import pandas as pd
from scipy import stats
d = pd.read_csv("before_after.csv")
p = stats.ttest_rel(d.after, d.before); ci = p.confidence_interval()
u = stats.ttest_ind(d.after, d.before, equal_var=False)
print(f"Paired t-test (same mice): mean change = {(d.after - d.before).mean():.2f} (95% CI {ci.low:.2f} to {ci.high:.2f}), t = {p.statistic:.2f}, df = {p.df:.0f}, p = {p.pvalue:.4f}")
print(f"Unpaired Welch t-test (pairing ignored): t = {u.statistic:.2f}, df = {u.df:.2f}, p = {u.pvalue:.3f}")
