{% from "_macros.html" import chart %}
{# The causal chart of the minimal-pair section of _experiment.html. Expects `v`, `c`, `sub`, `what`, `peer`, `peers`. The per-pair numbers are in that section's table. #}
{% if v.causal %}
{% set cc = v.causal %}
{% set _label %}Sufficiency and necessity percentiles {% if cc.rows %}for {{ cc.rows | length }} minimal pairs {% endif %}against the 0.5 baseline of matched {{ peers }}: median sufficiency {{ c.sufficiency_score | num(2) }}, necessity {{ c.necessity_score | num(2) }}.{% if cc.rows %} Values are in the table below.{% endif %}{% endset %}{% call chart(cc.width, cc.height, "Causal effects per minimal pair", _label | trim, role="img") %}
{% if cc.rule_y %}{% endif %}
{% for row in cc.rows + [cc.median] %}
{% set is_median = loop.last %}
{{ row.label }}
{% for b in row.bars %}
{{ b.label }}
{% if b.w is not none %}
{% endif %}
{% if is_median %}
{{ b.value | num(2) }}
{% endif %}
{% endfor %}
{% endfor %}
0.5 = a typical matched {{ peer }}
{% for tx, label in cc.ticks %}
{{ label }}
{% endfor %}
{% endcall %}
sufficiency (clean → corrupted) necessity (corrupted → clean){% if cc.rows %}Hover a bar for its effect and prompts.{% else %}This record predates per-pair effects, so only the medians are shown.{% endif %}
{% endif %}