triangulate¶
Phase 5 — cross-tool triangulation of Python vs R statistics within tolerance.
triangulate
¶
Phase 5 — cross-tool triangulation.
Compare the Python results against an independent R implementation, statistic by
statistic, within tolerance. This is the step that catches results which are
artifacts of one tool's defaults rather than properties of the data. Set
abs: true in a statistic's tolerance to compare magnitudes only, for
quantities whose sign is implementation-defined (e.g. PCA loadings).
A mismatch fails the build by default. For a statistic that legitimately differs
across tools for a defensible reason (robust-SE variant, ddof/denominator choice,
contrast coding), declare severity: info in its per-key tolerance so the
divergence is reported as INFO rather than FAIL — the run stays green and the
disagreement is surfaced for a human to interpret, instead of pressuring the
analyst to force one tool to mimic the other. A statistic that is simply absent
in one tool is always a hard failure (the replication is incomplete), regardless
of severity.
triangulate(py_results, r_results, tolerance)
¶
Compare Python and R results statistic by statistic within tolerance.
Iterates the union of statistic keys. A statistic absent from either side is always a
hard failure (the replication is incomplete). For statistics present in both, applies
the per-key tolerance (including magnitude-only comparison when abs is set); a
mismatch fails the build unless the statistic declares severity: info, in which
case it is reported as INFO instead.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
py_results
|
Mapping of statistic name to value from the Python implementation. |
required | |
r_results
|
Mapping of statistic name to value from the R implementation. |
required | |
tolerance
|
Tolerance configuration mapping, typically |
required |
Returns:
| Type | Description |
|---|---|
|
A |
|
|
class: |
|
|
dicts (keys |
|
|
report table. |