# Chapter 16 · Complete draft exercise solutions

**Constructed teaching fixtures. Author and independent technical review pending.**

1. Accuracy $(160+720)/1000=88\%$; precision $160/(160+80)=66.67\%$; recall $160/(160+40)=80\%$; specificity $720/(720+80)=90\%$. The model refers 240 cases, exceeding review capacity 180.
2. In 10,000 cases with 1% prevalence, 100 are positive and 9,900 negative. Sensitivity 90% gives 90 true positives; specificity 95% gives 495 false positives. PPV is $90/(90+495)=15.38\%$. If prevalence changes but conditional rates stay fixed, PPV changes; if rates also change, recompute from the new context. The fixed-rate calculation is not a transport guarantee.
3. Both MAEs are ten cases. A has squared errors $0,400,400,0$, so RMSE $\sqrt{200}=14.142$; B has four squared errors of 100, so RMSE ten. B avoids the largest miss, but direction of error, staffing cost, uncertainty and forecast issuance time may still change the choice.
4. One example: forecast issued Monday 1 June for Monday 15 June demand, horizon fourteen days. Realised future weather and a later revised category or demand count were unavailable at issuance. Preserve the exact forecast and data vintage.
5. For origin at month 12, use months 1–12 to predict 13; at origin 13, use 1–13 to predict 14; at 14, use 1–14 to predict 15. A random split can train on months after a target month and misrepresent the planned forward use.
6. Centres are 1.5 and 8.5; within-cluster squared error $4(0.5)^2=1$. Training error decreases when extra centres are added, including the trivial one-centre-per-point solution. Meaning and stability require independent justification.
7. Means are $(2.5,1.75)$. Sample covariance is $\left(\begin{smallmatrix}5/3&7/6\\7/6&11/12\end{smallmatrix}\right)$. Changing a feature unit changes its numeric variance and can rotate unstandardised components; report original units and scaling.
8. Median 11; absolute deviations $1,0,0,1,19$ have median zero. A MAD-scaled score would divide by zero. Inspect rounding, distribution and provenance of 30; choose a method with a defined degenerate case rather than automatically labelling fraud or error.
9. Review cost 2 versus nonreview expected miss cost $20p$ crosses at $p=0.1$; cost 10 gives 0.2. This assumes calibrated $p$, correctly specified costs, no other harms and adequate capacity.
10. Routine old/new 90/95%; complex old/new 20/30%. Observed old 83/100=83%, new 43/100=43%. Equal 50/50 mix gives old 55% and new 62.5%. The new period has a much larger complex share, so aggregation reverses the category-specific direction.
11. At routine weight 20%, old 34%, new 43%, contrast +9 points. At 50%, old 55%, new 62.5%, +7.5. At 80%, old 76%, new 82%, +6. The periods were not randomised and other factors may differ; changing reference weights does not identify the process's causal effect.
12. The manager page should distinguish observed fall, within-category rises and equal-mix descriptive comparison; state that reopening, workload, staffing and independent severity review are unavailable and propose verification or a prospective design. The reviewer page should identify the exact CSV and hash, row grain (period × category), denominators, four cell counts, check output and non-use conditions. Do not use the observational comparison as proof of benefit or harm.
