diff --git a/ui/core/components/raid_sim_action.tsx b/ui/core/components/raid_sim_action.tsx index a3844aafe5..fca0a7dcdc 100644 --- a/ui/core/components/raid_sim_action.tsx +++ b/ui/core/components/raid_sim_action.tsx @@ -312,7 +312,8 @@ export class RaidSimResultsManager { this.formatToplineResult( `.${RaidSimResultsManager.resultMetricClasses['cod']} .results-reference-diff`, res => res.getFirstPlayer()!.chanceOfDeath, - 1, + 2, + true, true, ); } else { @@ -330,6 +331,7 @@ export class RaidSimResultsManager { getMetrics: (result: SimResult) => DistributionMetricsProto | number, precision: number, lowerIsBetter?: boolean, + preNormalizedErrors?: boolean, ) { const elem = this.simUI.resultsViewer.contentElem.querySelector(querySelector); if (!elem) { @@ -347,15 +349,15 @@ export class RaidSimResultsManager { } else { const curMetrics = curMetricsTemp as DistributionMetricsProto; const refMetrics = refMetricsTemp as DistributionMetricsProto; - const isDiff = this.applyZTestTooltip(elem, ref.iterations, refMetrics.avg, refMetrics.stdev, cur.iterations, curMetrics.avg, curMetrics.stdev); + const isDiff = this.applyZTestTooltip(elem, ref.iterations, refMetrics.avg, refMetrics.stdev, cur.iterations, curMetrics.avg, curMetrics.stdev, !!preNormalizedErrors); formatDeltaTextElem(elem, refMetrics.avg, curMetrics.avg, precision, lowerIsBetter, !isDiff); } } - private applyZTestTooltip(elem: HTMLElement, n1: number, avg1: number, stdev1: number, n2: number, avg2: number, stdev2: number): boolean { + private applyZTestTooltip(elem: HTMLElement, n1: number, avg1: number, stdev1: number, n2: number, avg2: number, stdev2: number, preNormalized: boolean): boolean { const delta = avg1 - avg2; - const err1 = stdev1 / Math.sqrt(n1); - const err2 = stdev2 / Math.sqrt(n2); + const err1 = preNormalized ? stdev1 : stdev1 / Math.sqrt(n1); + const err2 = preNormalized ? stdev2 : stdev2 / Math.sqrt(n2); const denom = Math.sqrt(Math.pow(err1, 2) + Math.pow(err2, 2)); const z = Math.abs(delta / denom); const isDiff = z > 1.96; @@ -455,15 +457,17 @@ export class RaidSimResultsManager { } resultColumns.push({ - name: 'HPS', + name: 'TMI', average: tmiMetrics.avg, stdev: tmiMetrics.stdev, classes: this.getResultsLineClasses('tmi'), + unit: 'percentage', }); resultColumns.push({ name: 'COD', - average: chanceOfDeath, + average: chanceOfDeath.avg, + stdev: chanceOfDeath.stdev, classes: this.getResultsLineClasses('cod'), unit: 'percentage', }); @@ -614,9 +618,11 @@ export class RaidSimResultsManager { {data.map(({ average, stdev, classes, unit }) => { let value = ''; + let errorDecimals = 0; switch (unit) { case 'percentage': value = formatToPercent(average); + errorDecimals = 2; break; case 'seconds': value = formatToNumber(average, { style: 'unit', unit: 'second', unitDisplay: 'narrow' }); @@ -630,7 +636,7 @@ export class RaidSimResultsManager {
{value}
{stdev ? (
- {formatToNumber(stdev, { maximumFractionDigits: 0 })} + {formatToNumber(stdev, { maximumFractionDigits: errorDecimals })}
) : undefined}
@@ -649,20 +655,23 @@ export class RaidSimResultsManager { private static buildResultsList(data: ResultMetric[]): Element { return ( <> - {data.map(column => ( -
- {column.average.toFixed(2)} - {column.stdev && ( - - ( - {column.stdev.toFixed()}) - - )} -
- vs reference + {data.map(column => { + const errorDecimals = (column.unit === 'percentage') ? 2 : 0; + return ( +
+ {column.average.toFixed(2)} + {column.stdev && ( + + ( + {column.stdev.toFixed(errorDecimals)}) + + )} +
+ vs reference +
-
- ))} + ); + })} ); } diff --git a/ui/core/constants/tooltips.ts b/ui/core/constants/tooltips.ts index d0ebef0c0e..ccdeecd6aa 100644 --- a/ui/core/constants/tooltips.ts +++ b/ui/core/constants/tooltips.ts @@ -35,6 +35,7 @@ export const TOOLTIP_METRIC_LABELS = { 'Damage Taken': 'Total Damage taken', DTPS: 'Damage Taken / Encounter Duration', COD: 'Chance of Death', + TMI: 'Theck-Meloree Index', // Cast metrics Casts: 'Casts', CPM: 'Casts / (Encounter Duration / 60 Seconds)', diff --git a/ui/core/proto_utils/sim_result.ts b/ui/core/proto_utils/sim_result.ts index b6c80854f3..f4f1bdf12f 100644 --- a/ui/core/proto_utils/sim_result.ts +++ b/ui/core/proto_utils/sim_result.ts @@ -438,8 +438,14 @@ export class UnitMetrics { } } - get chanceOfDeath(): number { - return this.metrics.chanceOfDeath * 100; + get chanceOfDeath(): DistributionMetricsProto { + const p = this.metrics.chanceOfDeath; + const err = Math.sqrt(p * (1 - p) / this.iterations); + + return DistributionMetricsProto.create({ + avg: p * 100, + stdev: err * 100, + }); } get maxThreat() {