name: op-overlay-z-vs-ref
kind: operator
category: OVERLAY
operator: OVERLAY_Z_VS_REF
description: Compose-host per-group two-sample z-test on the means against the reference slot's matching group (SERIES); reads each group's mean, variance and n from its components.
type: reference
applies_to: compose
examples_tags: [overlay, compose, hypothesis-test, z, byte-equal-test]
Compose-only parity overlay: the two-means z per group, target slot against the reference slot; series sibling of the cell overlay. Shared contract: overlay-reference-tests.
Use when
Large-sample z-test for every group of a grouped result in a Compose request: does the target’s mean differ from the reference’s?
Questions it answers:
- With large samples, which regions’ average spend changed since last quarter?
- Which high-volume channels’ average basket differs between the two periods?
Use something else:
OVERLAY_T_VS_REFwhen any group is small; the t-based version is more honest there.
Params
| Name | Type | Default | Description |
|---|---|---|---|
field | string | — | OUTPUT LABEL to score on every slot (label, else TYPE_field) or an element column <label>[<elem>] (params.expand); absent = aggregations[0]; missing on a slot → PULSE_OVERLAY_FIELD_UNKNOWN. |
variance_target | float | — | Target sample variance, > 0; required for a mean measure. |
variance_ref | float | — | Reference sample variance; likewise. |
variance | float | — | Both sides, when a side’s own key is absent. |
sample_size_target | float | — | Target sample size; likewise. |
sample_size_ref | float | — | Reference sample size; likewise. |
sample_size | float | — | Both sides, when a side’s own key is absent. |
scope group; rows key on group columns. A mean measure needs the params for EVERY group and target (missing → PULSE_OVERLAY_PARAM_MISSING); other measures → PULSE_OVERLAY_REF_INCOMPATIBLE_WITH_SHAPE (measure_type); mean vs moments → PULSE_OVERLAY_SCHEMA_DIVERGENT. Allowlist: overlay-reference-tests.
Host shape
COMPOSE — SERIES host on both slots. Reads {n, mean, variance} from the per-group components of AGG_WELFORD or another moment-carrying measure (off → PULSE_OVERLAY_COMPONENTS_REQUIRED), else params. Crosstab slots → PULSE_OVERLAY_REF_INCOMPATIBLE_WITH_SHAPE (use the cell twin).
Output
SERIES — one entry per host group key, the p-value on summary.statistic; summary.baseline unset. One layer per target (<name>__<target> for 2+); cap max_panel_targets.
Reading the output
summary.statistic: a p-value. Below alpha (0.05 unless the request sets another) the result is called significant; that is not the same as important, so read the effect size for how big it is.- Caveat: Despite the field name, each series entry’s summary.statistic holds that group’s two-sided z-test p-value, not a z value; Pulse does not emit z.
- Caveat: It is read from the normal curve, so with small groups it comes out too small.
Contract
- Weight: weighted under
frequencyandprobabilityweights. - Multiplicity: a
multiplicitymethod addsp_adjustedandsignificant_adjustedbeside the raw p; familieslayer(default),request,compose(inside Compose). - Streaming: buffered only.
Gotchas
- A NaN value on either side → the entry keeps its key, NO
statistic(absent, notnull). - Weighted: legs read N* (
sum_weights/n_eff), never the rawn. - Equals the two-sample z-test on the same inputs.
- Missing reference row or degenerate inputs →
PULSE_OVERLAY_REF_ZERO(ref_missing=true), entrynull.