Custom aggte_fun for ptetools::pte that
handles the two-step weight renormalization needed when
pre_copula = "long": some (g,t) cells are structurally
uncomputable (their pre2 does not exist in the data), and those cells
must be excluded from aggregation with proper weight redistribution.
Two-step weights (overall):
Identify surviving groups (those with at least one valid post-treatment cell); renormalize \(p_g\) among those groups only.
Within each surviving group, assign equal weight \(p_g / |\text{valid cells for } g|\) to each valid post-treatment cell.
Dynamic (event-study) weights: for each event time e, renormalize \(p_g\) among groups where (g, g+e) is valid.
Error behaviour: if a structurally valid cell returns NA
att, the function errors immediately — such NAs indicate a bug in
panel_qtt_gt, not a structural limitation.
panel_qtt_long_agg(attgt.list, ptep, extra_gt_returns)A list with overall_results, dyn_results,
group_results, attgt_results, F0_overall,
F1_overall — matching the structure returned by
ptetools::qtt_pte_aggregations.
List of per-cell attgt results from compute.pte.
ptetools parameter environment.
List of per-cell extra returns (F0, F1, Fte ECDFs).