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-fisher-exact-cell
kind: operator
category: OVERLAY
operator: OVERLAY_FISHER_EXACT_CELL
description: Per-cell Fisher's exact two-sided p-value over a 2×2 contingency formed from each host crosstab cell + its margins.
type: reference
applies_to: process
examples_tags: [overlay, cross-tabulation, hypothesis-test, exact-test, small-sample]

Overlays decorate the host; no Response.Components.

Use when

Fisher’s exact test for every crosstab cell: checks whether being in that row goes with being in that column more or less than expected.

Questions it answers:

  • Which answer-by-segment cells stand out in this banner table?
  • In a small table, which cells hold more cases than the margins predict?

Use something else:

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

Params

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

Host shape

MATRIX crosstab of counts. The low-count backstop when expected < 5 breaks the χ² approximation.

Output

MATRIX — payload.matrix.cells[r][c].value = the two-sided p-value, on the host’s keys; absent host cells stay absent. summary.baseline unset (inferential).

Reading the output

  • cells.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.
    • Caveat: Each cell holds the two-sided exact p-value of its own 2x2 table: this row versus the rest, by this column versus the rest.
    • Caveat: It does not say which way or how far the cell departs: compare the cell’s count with what its row and column totals predict (or an OVERLAY_INDEX_VS_MARGIN layer) for direction and size.

Contract

  • Weight: weighted under frequency weights only; a probability weight is PULSE_WEIGHT_UNSUPPORTED.
  • 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

  • An undefined (NaN) host cell is MISSING: no p, no warning, out of summary.count.
  • Frequency-only: on a frequency-weighted host the exact test runs on the integer Σw table and summary.parameters adds sum_weights; a probability weight — on the overlay slot OR only on the host cell — is PULSE_WEIGHT_UNSUPPORTED naming the kind (predict AND runtime).
  • 2×2 contingency: [cell, row_margin-cell; col_margin-cell, grand-row_margin-col_margin+cell]. p equals the Fisher exact test’s on the same 2×2.
  • Cochran rule: any of four expected counts < 1 OR >= 20% of expected < 5 → ONE PULSE_OVERLAY_EXPECTED_LOW per offending cell. Advisory only — Fisher stays exact.
  • grand_total <= 0 → absent cells everywhere + ONE PULSE_OVERLAY_REF_ZERO.
  • Populated ref arm → PULSE_OVERLAY_REF_INCOMPATIBLE_WITH_SHAPE.
  • Reads cell values: a code cell (AGG_MODE over categorical_* / packed_bool — the modal dictionary index / truth value) → PROCESSING_CONFIG, reason categorical_code, slot: "crosstab.cell" (+ field, field_type), predict and runtime. Use a count cell.

See