Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

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_REF when any group is small; the t-based version is more honest there.

Params

NameTypeDefaultDescription
fieldstring—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_targetfloat—Target sample variance, > 0; required for a mean measure.
variance_reffloat—Reference sample variance; likewise.
variancefloat—Both sides, when a side’s own key is absent.
sample_size_targetfloat—Target sample size; likewise.
sample_size_reffloat—Reference sample size; likewise.
sample_sizefloat—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 frequency and probability weights.
  • Multiplicity: a multiplicity method adds p_adjusted and significant_adjusted beside the raw p; families layer (default), request, compose (inside Compose).
  • Streaming: buffered only.

Gotchas

  • A NaN value on either side → the entry keeps its key, NO statistic (absent, not null).
  • Weighted: legs read N* (sum_weights / n_eff), never the raw n.
  • Equals the two-sample z-test on the same inputs.
  • Missing reference row or degenerate inputs → PULSE_OVERLAY_REF_ZERO (ref_missing=true), entry null.

See