"""Original arithmetic from declared public inputs or explicit worked assumptions."""
import csv
from pathlib import Path
results={'treatment_sales':1124140,'scaled_control_sales':1014447,'estimated_incremental_sales':1124140-1014447,'sales_lower95':109693-1.96*31799,'sales_upper95':109693+1.96*31799,'estimated_incremental_transactions':10606-9474,'transactions_lower95':1132-1.96*209,'transactions_upper95':1132+1.96*209,'control_rescaling_factor':7/3,'worked_unique_before':100,'worked_unique_after':80,'worked_overlap':30,'worked_unique_whole':100+80-30,'worked_new_after_not_all_after':100+80-30-100}
assert results['estimated_incremental_sales']==109693 and results['worked_new_after_not_all_after']==50
p=Path(__file__).parent/"data";p.mkdir(exist_ok=True)
with (p/"ghost-opportunity-accounting.csv").open("w",newline="") as f:
 w=csv.writer(f);w.writerow(["metric","value"]);w.writerows(results.items())
print(results)
