Ceramic thickness reports underestimate variation across trays
Level 3 · node · Correctness · Missing between-group variation in hierarchical variance summary merges
Scenario
A fictional ceramic workshop summarizes thickness readings per tray and hierarchically merges summaries across trays and work zones. Raw readings are used only at the trays. Individual tray reports and the overall mean are correct, but the overall variance is too small when trays with different mean thicknesses are combined. Trace the data contract across reading summaries, hierarchical merges and final reports.
Requirements
report(tree) takes a tree with numeric arrays as leaves or internal nodes shaped as {children:[...]} and returns {count,mean,variance} for all readings. Readings are small finite numbers and variance is population variance over all readings. An empty tree returns {count:0,mean:0,variance:0}. Leaves pass only count, mean and m2 (sum of squared deviations from the mean) upward. Internal nodes merge only those three fields from their children and do not collect or store raw readings again. Results must be independent of merge order and partitioning into trays and zones, allowing floating-point error. Do not mutate inputs or child summaries.
Acceptance criteria
- Empty trees and individual trays have correct counts, means and population variances.
- Overall variance is correct when readings are constant within each tray but differ across trays.
- Counts, means and variances for unequal tray sizes agree with statistics of all original readings and are independent of partitioning.
- Nested work zones and empty nodes merge into equivalent statistics while preserving original data and summary objects.