Skip to content
Astera Technology

Compare startup observations under matched conditions

Keep cold and warm observations separate before averaging offers.

Download complete case notes and answer keys ↓

Set the decision and its input

The supplied synthetic observations give A cold8/9 seconds and warm1/2; B cold10/12. The required comparison is cold, so means are8.5 and11. Selecting A’s warm observations produces1.5 beside B’s cold11 and misstates the test condition.

Filled local test worksheet
CaseInput JSON
Base test{"condition":"cold","observations":[{"offer":"A","condition":"cold","seconds":8},{"offer":"A","condition":"cold","seconds":9},{"offer":"A","condition":"warm","seconds":1},{"offer":"A","condition":"warm","seconds":2},{"offer":"B","condition":"cold","seconds":10},{"offer":"B","condition":"cold","seconds":12}]}
Download editable CSV ↓

Run the supplied comparison

The executable selection matches condition before calculating means. These timings are supplied records, not actual supplier benchmarks or expected future service performance.

Faulty and required outputs
PathOutput JSON
Faulty path{"condition":"cold","means":{"A":1.5,"B":11}}
Required path{"condition":"cold","means":{"A":8.5,"B":11}}
Download editable CSV ↓
Complete local Node24.14.1 programme
import assert from 'node:assert/strict';

const run=function run(i,corrected=true){
    if(!['warm','cold'].includes(i.condition)||i.observations.some(r=>!Number.isFinite(r.seconds)||r.seconds<0))return {held:true};
    const groups={A:i.observations.filter(r=>r.offer==='A'&&r.condition===(corrected?i.condition:'warm')),B:i.observations.filter(r=>r.offer==='B'&&r.condition===i.condition)};
    const missing=Object.keys(groups).filter(k=>groups[k].length===0);if(missing.length)return {held:true,missing};
    const means=Object.fromEntries(Object.entries(groups).map(([k,rs])=>[k,rs.reduce((s,r)=>s+r.seconds,0)/rs.length]));return {condition:i.condition,means};
  };
const cases=[{"input":{"condition":"cold","observations":[{"offer":"A","condition":"cold","seconds":8},{"offer":"A","condition":"cold","seconds":9},{"offer":"A","condition":"warm","seconds":1},{"offer":"A","condition":"warm","seconds":2},{"offer":"B","condition":"cold","seconds":10},{"offer":"B","condition":"cold","seconds":12}]},"corrected":false,"expected":{"condition":"cold","means":{"A":1.5,"B":11}}},{"input":{"condition":"cold","observations":[{"offer":"A","condition":"cold","seconds":8},{"offer":"A","condition":"cold","seconds":9},{"offer":"A","condition":"warm","seconds":1},{"offer":"A","condition":"warm","seconds":2},{"offer":"B","condition":"cold","seconds":10},{"offer":"B","condition":"cold","seconds":12}]},"corrected":true,"expected":{"condition":"cold","means":{"A":8.5,"B":11}}},{"input":{"condition":"warm","observations":[{"offer":"A","condition":"warm","seconds":1}]},"corrected":true,"expected":{"held":true,"missing":["B"]}},{"input":{"condition":"warm","observations":[{"offer":"A","condition":"warm","seconds":1},{"offer":"A","condition":"warm","seconds":2},{"offer":"B","condition":"warm","seconds":2},{"offer":"B","condition":"warm","seconds":3}]},"corrected":true,"expected":{"condition":"warm","means":{"A":1.5,"B":2.5}}}];
for(const test of cases){const actual=await run(test.input,test.corrected);assert.deepEqual(actual,test.expected);console.log(actual);}
Download runnable example ↓

Choose from the boundary evidence

A warm comparison with no B warm observation is held. When both warm sets are supplied, their means1.5/2.5 can be compared under that different condition.

  1. Name the requested startup condition
  2. Select matching observations for both offers
  3. Calculate and label their means

Missing matched observations remain unknown, not slow or failed.

Editable boundary inputs and outputs
ConditionInput JSONExpected output JSON
missing matched offer observation{"condition":"warm","observations":[{"offer":"A","condition":"warm","seconds":1}]}{"held":true,"missing":["B"]}
matched warm observations{"condition":"warm","observations":[{"offer":"A","condition":"warm","seconds":1},{"offer":"A","condition":"warm","seconds":2},{"offer":"B","condition":"warm","seconds":2},{"offer":"B","condition":"warm","seconds":3}]}{"condition":"warm","means":{"A":1.5,"B":2.5}}
Download editable CSV ↓

Which two means belong to the base cold comparison?

Show the worked answer

A8.5 seconds and B11 seconds. A1.5 belongs to its warm observations and must not be relabelled cold.

Related resources