"""Chapter 29.3 and exercise 29.2: a detected count is not an occurrence rate. The study reports that 39 cheating attempts were detected in about 1600 research trajectories. How many attempts actually occurred depends on two numbers the count alone does not give: recall = share of real attempts that the detection method flags precision = share of flagged trajectories that really are attempts real attempts ~= detected * precision / recall. The recall and precision values below are hypothetical, chosen for teaching only. """ detected = 39 print("Implied number of real attempts for hypothetical recall and precision") print(" recall precision=100% precision=80%") for recall in (1.00, 0.75, 0.50, 0.25): full = detected * 1.00 / recall part = detected * 0.80 / recall print(f" {recall:>5.0%} {full:>14.1f} {part:>13.1f}")