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-prior
kind: operator
category: OVERLAY
operator: OVERLAY_Z_VS_PRIOR
description: Large-sample z-test of each period's mean against the period before it on an ordered SERIES host or a crosstab with no column grouper; independent samples only.
type: reference
applies_to: process
examples_tags: [overlay, time-series, hypothesis-test, two-sample, z, welford-triple]

Inferential prior-period test. Overlays decorate the host; no Response.Components.

Use when

Large-sample z-test of each period’s mean against the period before it: did the average change from the last wave?

Questions it answers:

  • With large waves, did the average spend per visit change from last quarter?
  • Which weeks’ mean basket differs from the week before beyond chance?

Use something else:

  • OVERLAY_T_VS_PRIOR when some periods are small.

Params

NameTypeDefaultDescription
fieldstring—On a SERIES host, the OUTPUT LABEL of the aggregation to score (explicit label, else TYPE_field) or one expanded element column "<label>[<element label>]"; absent, the first aggregation.
partition_bylist—Over two or more groupers, the leading group key columns each partition shares (default every key but the last; [] = one walk over every row; the YoY overlay: exactly the non-date keys).

scope must be group, ref.prior (or empty; no lag), level / within 0; refusals and params.field / params.partition_by as on the prior delta: overlay-reference-tests.

Host shape

Two hosts: an ordered SERIES host (partitions as the delta twin) or a crosstab with NO columns — its rows are the periods of the implicit Total column. A crosstab with columns, or several measures, → PULSE_OVERLAY_REF_INCOMPATIBLE_WITH_SHAPE (reason: column_grouper). The scored measure must carry the Welford triple {mean, variance, n} (AGG_WELFORD, AGG_VARIANCE, AGG_STDDEV), else the same code with measure_type. Legs {n, mean, variance} come from the measure’s per-group (or per-cell) components: components disabled → PULSE_OVERLAY_COMPONENTS_REQUIRED.

Output

SERIES — one entry per period in host order: summary.statistic = z of this period minus the prior, summary.p_value its two-sided normal p — fair only when every period is large. Layer summary: count, min / max.

Reading the output

  • summary.statistic: In each series entry (one per period): the z statistic of this period minus the period before it, in standard errors. Null on the first period and on a test that could not be computed; read the entry’s p_value for the test.
    • Sign: positive means this period is higher than the one before; negative means this period is lower than the one before.
  • summary.p_value: 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.

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

  • Independence assumed: a panel (same respondents both waves) makes the p-value wrong, undetected.
  • First period → statistic null, no p_value; a missing period keeps its key, the carrier does not advance (overlay-reference-tests).
  • Degenerate pair (n < 2, se == 0) → null entry; one PULSE_OVERLAY_REF_ZERO per skip reason (details.reason).
  • Weighted: N* = sum_weights (frequency) or n_eff (probability), variance from m2.

See