"""Arithmetic on the abstract's own numbers (RULES_arithmetic.txt). Standard library only. Fact-Checked Science ("Our analysis"), 20 November 2026, for the check of Marschollek's AGU26 abstract GH11D-VR9816. Every input is a number printed in the abstract (paragraphs 1, 3 and 4). Run: python3 -I arithmetic.py """ import json import math import os import sys from statistics import NormalDist N = NormalDist() TOTAL = 205212 SEX = {"male": 124279, "female": 78358, "unknown": 2575} AGE = {"under_65": 99692, "65_or_older": 102336, "missing": 3184} # effect (per cent, as printed, sign dropped) and p as printed; "p<0.001" kept as a bound EFFECTS = { "total_previous_research": {"pct": 6.4, "p": 0.009, "bound": False, "n": TOTAL}, "female": {"pct": 8.3, "p": 0.006, "bound": False, "n": SEX["female"]}, "male": {"pct": 5.7, "p": 0.025, "bound": False, "n": SEX["male"]}, "65_or_older": {"pct": 9.1, "p": 0.001, "bound": True, "n": AGE["65_or_older"]}, "under_65": {"pct": 4.4, "p": 0.077, "bound": False, "n": AGE["under_65"]}, } DAYS = 14 def se_from_p(pct, p, sided): z = N.inv_cdf(1 - p) if sided == 1 else N.inv_cdf(1 - p / 2) return pct / z, z def diff_test(a, b, se_a, se_b): se = math.sqrt(se_a ** 2 + se_b ** 2) z = abs(a - b) / se return {"difference_points": round(a - b, 2), "se_difference": round(se, 3), "z": round(z, 3), "p_two_sided": round(2 * (1 - N.cdf(z)), 3)} def main(): outdir = sys.argv[1] os.makedirs(outdir, exist_ok=True) out = {"rules": "RULES_arithmetic.txt"} out["A1_sums"] = {"sex_sum": sum(SEX.values()), "age_sum": sum(AGE.values()), "total": TOTAL, "sex_matches": sum(SEX.values()) == TOTAL, "age_matches": sum(AGE.values()) == TOTAL, "female_share_of_known_sex_pct": round(100 * SEX["female"] / (SEX["female"] + SEX["male"]), 1), "older_share_of_known_age_pct": round(100 * AGE["65_or_older"] / (AGE["65_or_older"] + AGE["under_65"]), 1)} per = {} for k, v in {"total": TOTAL, **SEX, **AGE}.items(): per[k] = {"per_day": round(v / 365, 1), "per_14_days": round(v * DAYS / 365, 1)} out["A2_rates_at_2015_average"] = per a3 = {} for k, e in EFFECTS.items(): n14 = e["n"] * DAYS / 365 a3[k] = {"pct": -e["pct"], "count_14_days": round(n14, 1), "cases_in_14_days": round(e["pct"] / 100 * n14, 1), "cases_per_day": round(e["pct"] / 100 * e["n"] / 365, 1)} out["A3_percentages_in_cases"] = a3 f, m = a3["female"], a3["male"] o, y = a3["65_or_older"], a3["under_65"] out["A4_implied_total_drop_pct"] = { "by_sex": round(100 * (f["cases_in_14_days"] + m["cases_in_14_days"]) / (f["count_14_days"] + m["count_14_days"]), 2), "by_age": round(100 * (o["cases_in_14_days"] + y["cases_in_14_days"]) / (o["count_14_days"] + y["count_14_days"]), 2), "paragraph_1_previous_research": 6.4} a5 = {} for k, v in {"total": TOTAL, "female": SEX["female"], "male": SEX["male"], "65_or_older": AGE["65_or_older"], "under_65": AGE["under_65"]}.items(): n14 = v * DAYS / 365 sd = math.sqrt(n14) a5[k] = {"count_14_days": round(n14, 1), "poisson_sd": round(sd, 1), "sd_pct": round(100 * sd / n14, 2), "range95_pct": round(196 * sd / n14, 2)} out["A5_poisson_noise_14_days"] = a5 a6 = {} for sided in (1, 2): rows = {} for k, e in EFFECTS.items(): se, z = se_from_p(e["pct"], e["p"], sided) pois = a5["total" if k == "total_previous_research" else k]["sd_pct"] rows[k] = {"z": round(z, 3), "se_pct": round(se, 3), "se_is_upper_bound": e["bound"], "ratio_to_poisson_sd": round(se / pois, 2)} a6["one_sided" if sided == 1 else "two_sided"] = rows out["A6_implied_se"] = a6 a7 = {} for sided, key in ((1, "one_sided"), (2, "two_sided")): s = a6[key] fm = diff_test(8.3, 5.7, s["female"]["se_pct"], s["male"]["se_pct"]) old_bound = diff_test(9.1, 4.4, s["65_or_older"]["se_pct"], s["under_65"]["se_pct"]) old_zero = diff_test(9.1, 4.4, 0.0, s["under_65"]["se_pct"]) a7[key] = {"female_vs_male": fm, "older_vs_younger_at_se_bound": old_bound, "older_vs_younger_if_older_se_were_0": old_zero, "older_vs_younger_p_range": [old_zero["p_two_sided"], old_bound["p_two_sided"]]} out["A7_difference_tests"] = a7 with open(os.path.join(outdir, "arithmetic.json"), "w", newline="\n", encoding="utf-8") as fh: json.dump(out, fh, indent=1) fh.write("\n") print(json.dumps(out, indent=1)) if __name__ == "__main__": main()