# Analysis Summary: Distance Between Flies ## Key Findings ### Overall Statistics - Trained flies (aligned to barrier opening): - Data points: 46,613 - Mean distance: 92.72 - Std distance: 111.86 - Untrained flies (aligned to barrier opening): - Data points: 46,866 - Mean distance: 78.67 - Std distance: 102.86 ### Pre-Opening Period (t < 0) During this period, flies are physically separated by a barrier: - Trained mean distance: 155.27 - Untrained mean distance: 147.19 ### Post-Opening Period (t > 0) After the barrier is removed and flies can interact: - Trained mean distance: 77.44 - Untrained mean distance: 61.87 ## Statistical Tests ### Pre-opening period comparison: - Trained mean: 155.27, Untrained mean: 147.19 - T-statistic: 4.4024, P-value: 1.08e-05 - Cohen's d: 0.0654 ### Post-opening period comparison: - Trained mean: 72.52, Untrained mean: 63.86 - T-statistic: 30.4693, P-value: 1.08e-203 - Cohen's d: 0.0914 ### Within-group changes: - Trained flies - Pre vs Post: - Mean change: -82.75 - T-statistic: 77.2805, P-value: 0.00e+00 - Cohen's d: -0.8313 - Untrained flies - Pre vs Post: - Mean change: -83.33 - T-statistic: 84.4719, P-value: 0.00e+00 - Cohen's d: -0.9022 ## Interpretation 1. **Pre-opening**: Both groups show high distances as expected since flies are separated by a barrier. There is a statistically significant difference between groups (p < 0.001), but the effect size is very small (Cohen's d = 0.0654). 2. **Post-opening**: Both groups show reduced distances after the barrier is removed, indicating interaction between flies. There is a statistically significant difference between groups (p < 0.001) with a small effect size (Cohen's d = 0.0914). 3. **Within-group changes**: Both trained and untrained flies show significant decreases in distance after the barrier opens (p < 0.001). The effect sizes are large for both groups (Cohen's d = -0.8313 for trained, -0.9022 for untrained). 4. **Group Differences**: - Trained flies maintain slightly higher distances than untrained flies both before and after barrier opening. - This could indicate different behavioral patterns between trained and untrained flies, though the effect sizes are small. ## Visualization The plot "avg_distance_aligned_to_opening.png" shows: - Blue line: Average distance for trained flies (smoothed) - Red line: Average distance for untrained flies (smoothed) - Black dashed line: Time of barrier opening (t=0) The visualization clearly shows the transition from high distances (pre-opening) to lower distances (post-opening) for both groups, with trained flies consistently maintaining slightly higher distances than untrained flies.