fix: coverage-aware event-study headline instead of misleading median delta
The "warned a median -18 days later" line was the median-over-1-event trap: the coincident baseline's 60d median is a single lucky event, while breadth warned on 7. Replace it with the honest coverage framing (7/11 vs 1/11) and flag that the median-lead comparison is unreliable when coverage differs this much. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -375,26 +375,25 @@ function EventStudyBody({ report }: { report: EventStudyReport }) {
|
||||
const recent = report.recent_breadth ?? [];
|
||||
const breadthVals = recent.map((r) => r.breadth);
|
||||
const divVals = recent.map((r) => r.divergence ?? 0);
|
||||
const lead = report.lead_delta_days;
|
||||
const moreCoverage = bd.events_with_signal > cd.events_with_signal;
|
||||
return (
|
||||
<div className="space-y-4">
|
||||
<p className="text-xs text-gray-500">
|
||||
{report.events?.length ?? 0} drawdown events (≥{report.params?.event_threshold_pct}%) on{' '}
|
||||
{report.params?.benchmark} over ~5y. Higher median lead = earlier warning.
|
||||
{report.params?.benchmark} over ~5y. With so few events, coverage (how many it warned before) matters
|
||||
more than the median lead.
|
||||
</p>
|
||||
<div className="grid grid-cols-1 gap-2 sm:grid-cols-2">
|
||||
<LeadStat label="Breadth divergence (leading candidate)" stats={bd} highlight={lead != null && lead > 0} />
|
||||
<LeadStat label="Breadth divergence (leading candidate)" stats={bd} highlight={moreCoverage} />
|
||||
<LeadStat label="Coincident price composite (baseline)" stats={cd} />
|
||||
</div>
|
||||
{lead != null && (
|
||||
<p className="text-xs text-gray-400">
|
||||
Breadth divergence warned a median{' '}
|
||||
<span className={`font-medium ${lead > 0 ? 'text-emerald-400' : 'text-amber-400'}`}>
|
||||
{lead > 0 ? '+' : ''}{lead} days
|
||||
</span>{' '}
|
||||
{lead >= 0 ? 'earlier' : 'later'} than the coincident baseline.
|
||||
</p>
|
||||
)}
|
||||
<p className="text-xs text-gray-400">
|
||||
Breadth divergence warned before{' '}
|
||||
<span className="font-medium text-emerald-400">{bd.events_with_signal}/{bd.events_total}</span> drawdowns
|
||||
{bd.median_lead_days != null ? ` (median ${bd.median_lead_days}d lead)` : ''}; the coincident baseline only{' '}
|
||||
<span className="font-medium text-gray-300">{cd.events_with_signal}/{cd.events_total}</span>. The median-lead
|
||||
comparison is unreliable when coverage differs this much — see per-drawdown below.
|
||||
</p>
|
||||
{report.per_event && report.per_event.length > 0 && (
|
||||
<div className="space-y-1.5">
|
||||
<div className="text-[11px] uppercase tracking-wider text-gray-500">Per drawdown (same events, both indicators)</div>
|
||||
|
||||
Reference in New Issue
Block a user