"""Recalculate the two published R-squared differences used by MSC-P-027."""
from __future__ import annotations

import csv
import argparse
from pathlib import Path


def main() -> None:
    parser = argparse.ArgumentParser()
    parser.add_argument("--csv", type=Path, default=Path(__file__).resolve().parent.parent / "datasets" / "msc-p027-tam-utaut.csv")
    path = parser.parse_args().csv
    with path.open(encoding="utf-8", newline="") as handle:
        rows = list(csv.DictReader(handle))
    for row in rows:
        delta = float(row["r2_utaut2"]) - float(row["r2_utaut"])
        print(f'{row["outcome"]}: delta_r2={delta:.2f}')
    print("scope=published historical comparison; no refit; no causal claim")


if __name__ == "__main__":
    main()
