research analysis uses the metric as its own control and reads an empty group as level 0
Three separate defects in research/scripts/analyze_experiments.py. They share one output table, so they are filed together, but each stands on its own.
Environment
| Commit | d03ff6c |
| Python | 3.14.7 |
| OS | macOS 26.6.2, arm64 |
1. The metric is used as its own control
CONTROL_COLUMNS (analyze_experiments.py:34) starts with max_drawdown and ends with weight. regression_rows picks the first of those columns that carries any value (:169), without excluding the metric under analysis. analyze calls analysis_rows(challenge_results, "max_drawdown", ...) (:286) and analysis_rows(edges, "weight", ...) (:290), so for those two the control column is the metric itself.
With x == y the slope is 1 and adjusted = y - 1 * (x - x_mean) = x_mean for every row. All adjusted values are identical, so the effect is exactly zero regardless of the data.
hte_rows picks the segmentation column the same way (:197), so the same two analyses split the sample on the outcome variable.
raw mean max_drawdown, control: 3.0
raw mean max_drawdown, treatment: 20.0
raw difference: 17.0
method segment variant effect p
ab_test all treatment 17.0000 0.0000
regression_with_controls control:max_drawdown treatment 0.0000 1.0000
heterogeneous_treatment_effects max_drawdown:low control 0.0000 1.0000
heterogeneous_treatment_effects max_drawdown:high treatment 0.0000 1.0000The ab_test row sees the difference. The two adjusted rows report zero. In the HTE rows the split on max_drawdown separates the variants completely, so each segment holds one variant and no contrast is left.
2. An empty pre or post group counts as level 0
did_rows computes (mean(variant_post) - mean(variant_pre)) - (mean(control_post) - mean(control_pre)) (:148). research_common.mean returns 0.0 for an empty list (research_common.py:100-102), so a variant with no rows on one side of the split enters the difference at level 0 instead of being excluded.
Control reports 10.0 on days 1 to 4. Treatment reports 30.0 on days 1 and 2 and has no row after the split, so it changed by 0.0 over the period it is observed in:
variant segment effect p_value n_variant
control pre_post_split:2026-09-02T00:00:00Z 0.0000 1.0000 1
treatment pre_post_split:2026-09-02T00:00:00Z -30.0000 1.0000 1The reported effect is -30.0.
3. p_value is a constant on every DiD row
did_rows overwrites the computed value with row["p_value"] = 1.0 (:163) and the row then passes through benjamini_hochberg. A reader of rq_hypothesis_metrics.csv cannot tell a DiD row that was tested from one that was not, and the constant also shifts the BH ranks of the rows that were tested.
The same ambiguity exists in normal_p_value (research_common.py:132-134): stderr <= 0 returns 1.0, which is the value a real test would produce for no effect. did_rows always calls effect_row with single element lists, so stderr is 0 there by construction.
Not verified
- Run against literal input rows, not against a real
research/exportsdirectory. - The effect of the constant
p_valueonq_valueordering was reasoned from the BH implementation, not measured on a real table. - Whether the analysis scripts have been used to produce published numbers is unknown.
Source: HKUDS/AI-Trader