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-std-residual
kind: operator
category: OVERLAY
operator: OVERLAY_STD_RESIDUAL
description: Per-cell Haberman adjusted standardized residual of the host crosstab, with expected counts and two-sided p-values as parts.
type: reference
applies_to: process
examples_tags: [overlay, cross-tabulation, hypothesis-test]

Overlays decorate the host; no Response.Components.

Use when

Adjusted residual for every crosstab cell: how far its count sits above or below what its row and column totals predict.

Questions it answers:

  • Which cells drive the association in this crosstab?
  • Which brand-by-attribute cells are over- or under-represented?

Use something else:

  • OVERLAY_CHISQ_MATRIX when you want one test for the whole table.

Params

scope must be cell. ref empty (implicit-margin). level/within 0.

Host shape

MATRIX crosstab.

Output

MATRIX residual (O − E) / sqrt(E (1 − r/N) (1 − c/N)), E = r c / N (R chisq.test()$stdres). Parts expected and p (two-sided normal), MATRIX on the same keys. Layer summary: baseline 0, min / max / count of defined residuals.

Reading the output

  • cells.value: The cell’s adjusted standardized residual: (observed - expected) divided by its standard error, where expected is the count the row and column totals predict if the two fields were independent. Under independence it is about standard normal, so a value beyond plus or minus 1.96 is unusual at the 5% level; the cells with the largest absolute values are the ones driving the table’s chi-square.
    • Caveat: A cell whose expected count is 0 (an empty row or column) has no residual and is null.

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), row, column, request, compose (inside Compose).
  • Streaming: buffered only.

Gotchas

  • Weights as op-overlay-chisq-matrix (Kish-scaled under probability).
  • Absent or undefined (NaN) cell = 0 (missing). E = 0 ⇒ residual, p null. Any E < 5 ⇒ one PULSE_OVERLAY_EXPECTED_LOW.
  • Host < 2×2, zero total or a ref ⇒ PULSE_OVERLAY_REF_INCOMPATIBLE_WITH_SHAPE.
  • Code cell (AGG_MODE) ⇒ PROCESSING_CONFIG categorical_code.

See