Hospitals tried a new treatment, and each reports how many patients got it and recovered, and how many didn’t get it and recovered. Write treatment_effect(hospitals): how much the treatment changes the recovery rate, as a share (0.1 = 10 points better), meaning the difference you would see if every hospital’s patients got it versus if none did.
Two hospitals tried a new treatment. In each one, the patients who got it recovered more often. Lump everyone together, and the patients who got it did worse: most of them were in City, where patients are sicker. The goal is one number for what the treatment does, the way each hospital sees it. Your treatment_effect() works it out.
treatment_effect(hospitals)| hospitals | one row per hospital, [treated_recovered, treated_total, untreated_recovered, untreated_total] (a list of lists) | e.g. [[30, 40, 20, 40]] |
| returns | how much the treatment changes the recovery rate, e.g. 0.1 for 10 points better, -0.1 for worse | |