name: op-overlay-zscore-vs-total
kind: operator
category: OVERLAY
operator: OVERLAY_ZSCORE_VS_TOTAL
description: Per-group streamable z-score against the SERIES host's grand-total distribution (population SD).
type: reference
applies_to: process
examples_tags: [overlay, outlier-detection, streaming-friendly]
Overlays decorate the host; no Response.Components.
Use when
How many standard deviations each group’s value sits from the average of all groups on a grouped result: which groups stand out?
Questions it answers:
- Which stores’ sales are unusually high or low compared with the other stores?
- Which regions stand out from the rest on average rating?
Use something else:
TEST_ANOVA_WELCHwhen you want to test whether group averages differ, from raw rows.
Params
| Name | Type | Default | Description |
|---|---|---|---|
field | string | — | OUTPUT LABEL of the aggregation to score (label, else TYPE_field) or an expanded element column <label>[<elem>] (params.expand); absent = aggregations[0]; unknown → PULSE_OVERLAY_FIELD_UNKNOWN. |
partition_by | list | — | A leading prefix of the group key columns (Host shape); anything else → PULSE_OVERLAY_PARTITION_INVALID. |
scope required, must be group. ref empty (implicit grand-total; populated → PULSE_OVERLAY_REF_INCOMPATIBLE_WITH_SHAPE). level / within must be 0.
Host shape
SERIES host. Over two or more groups the mean and SD are each partition’s own — the rows sharing the leading keys params.partition_by names (default all but the last; [] = every row), matched by key equality. Streamable alongside the total index and grand-total share.
Output
SERIES — one entry per host group key in host order, summary.statistic = (group − mean) / sd across the present groups, sd the POPULATION SD (÷ N). Layer summary.baseline = 0.
Reading the output
summary.statistic: In each series entry: how far the group’s value sits from the average of all groups, in standard deviations of the group values (dividing by the number of groups). 0 means the group equals that average.- Sign: positive means the value sits above its centre; negative means the value sits below its centre.
- Caveat: The spread is between groups, not between rows within a group.
Contract
- Weight: not read; a weight in force is skipped.
- Streaming: streamable.
Gotchas
- POPULATION SD: the per-group set IS the standardisation target. Contrast the rolling z-score (sample SD, n-1); matches the margin z-score’s denominator — but the variance is across GROUPS, not raw records.
sd == 0(all groups equal, or a single group) →null+ ONEPULSE_OVERLAY_REF_ZEROper layer. Absent host group → nostatistic, not in the mean or SD.- Streamable — the mean and SD accumulate inside the Process fold.