"""Simple arithmetic from Free et al. 2011, not a reanalysis of individual data.
Source: https://pmc.ncbi.nlm.nih.gov/articles/PMC3143315/
Table 2 and Results; accessed 2026-10-19.
"""
from math import isclose

rounded_main_rr = 10.7 / 4.9
rounded_main_difference_pp = 10.7 - 4.9
missing_as_smoking = (268 / 2911) / (124 / 2881)
complete_rates = (268 / 2735, 124 / 2789)
complete_rr = complete_rates[0] / complete_rates[1]

assert isclose(rounded_main_difference_pp, 5.8)
assert round(missing_as_smoking, 2) == 2.14
assert round(complete_rr, 2) == 2.20
print(f'Rounded main percentages ratio: {rounded_main_rr:.4f}')
print(f'Rounded main absolute difference: {rounded_main_difference_pp:.1f} percentage points')
print(f'Missing outcomes counted as smoking RR: {missing_as_smoking:.4f}')
print(f'Complete outcome proportions: {complete_rates[0]:.4%}, {complete_rates[1]:.4%}')
print(f'Complete outcome RR: {complete_rr:.4f}')
print('Published main imputed RR remains 2.20 (95% CI 1.80 to 2.68).')
print('No imputation or confidence interval is recomputed by this script.')
