# Chapter 10 — complete draft exercise solutions

Constructed teaching cases. Independent technical and author review remain pending.

1. Permutation varies allowed assignments or labels under a specified null and design. Bootstrap varies which observed units appear, with replacement, to approximate an estimator's sampling variation. Ranking changes the measurement scale to order and asks a question about relative positions. Bayesian updating changes a probability distribution over unknown parameters using a prior and likelihood.
2. $\binom84=70$. Classroom assignment allows whole-class swaps, not independent student swaps; shuffling students represents a different experiment and usually understates uncertainty when classmates are correlated.
3. Treatment values $(4,5,5,10)$ sum to 24 and average 6; control $(1,2,2,3)$ sum to 8 and average 2. Difference 4. With total 32 and treated sum $S$, the difference is $S/4-(32-S)/4=S/2-8$.
4. A sharp no-effect null says each unit's outcome is identical under treatment and control, filling in all missing potential outcomes for reassignment. Average-zero allows positive and negative individual effects that cancel, so alternative assignments' outcomes cannot be determined from the observed data alone.
5. Including the observed arrangement yields a nonzero finite-simulation estimate and a valid common randomisation calibration when the sampling scheme and statistic support it. Report $B$, the extreme count $b$, seed, allowed assignment rule, statistic, tail definition and Monte Carlo uncertainty near a decision threshold.
6. A mean is 22.8 seconds, B mean 8. Among 25 A–B cross-group pairs, A is faster in 20 and slower in 5. A safety question about rare extreme waits needs tail frequency and magnitude; ranking alone hides the 100-second event's severity.
7. There are $3^3=27$ ordered draws because each of three draw positions independently chooses one of the three observed values. The resampling support is only $\{2,3,10\}$, so 100 cannot appear. Exact median masses are 7 at 2, 13 at 3 and 7 at 10.
8. Prior density is constant in $p$, equivalent to beta$(1,1)$. Likelihood is proportional to $p^2(1-p)^8$; posterior beta$(3,9)$. Posterior mean and next-trial predictive success probability are $3/(3+9)=.25$ under a stable common-$p$ model.
9. Beta$(2,8)$ becomes beta$(4,16)$ with mean .2; beta$(20,80)$ becomes beta$(22,88)$ with mean .2. The second posterior has much greater concentration and much narrower credible range because its prior is stronger, though its centre is the same.
10. Starting beta$(1,1)$ and observing ten successes plus ten failures overall gives beta$(11,11)$. The change from 2/10 in the first period to 8/10 in the second may indicate process drift, so the constant common-$p$ likelihood deserves a time-pattern check.
11. If schools are the independently sampled units, resample the fifty schools and carry each school's answer rows. Only fifty independent clusters limit precision about between-school variation; within-school sample size cannot replace missing schools.
12. Example: “Target: next month's mean return rate across eligible customers. Mechanism: a customer-level bootstrap resamples eligible customer IDs and all their transactions. Assumption: the observed customers represent the target period's customer mix. Failure: campaign-driven selection or seasonality changes that mix. The interval approximates customer-sampling variation under the empirical stand-in and does not quantify the unobserved selection shift.”

## Further worked checks from the chapter

- Eight-unit exact permutation: two of seventy assignments have absolute mean difference at least four, giving two-sided $p=2/70=.028571$ under the sharp null and uniformly random balanced assignment.
- Four matched pairs: sixteen valid within-pair sign patterns; all-positive and all-negative are the two extreme absolute-sum cases for differences $(1,2,3,4)$, giving $2/16=.125$.
- Five all-negative paired changes: the symmetric independent sign-null gives two extreme patterns of $2^5=32$, or .0625 two-sided. This is a different statistic/model from the paired mean $t$ calculation.
- Beta$(3,9)$ after two of ten with a uniform prior: the executed equal-tailed 95% credible interval is approximately $[.060218,.517756]$. Its next-ten beta-binomial predictive variance is about 3.1731, compared with 1.875 for a binomial plug-in at .25.
- With shortage cost ten and spare cost one in the chapter's constructed decision, expected losses for four, five and six spares are approximately 6.368, 5.967 and 6.333. Five is the minimum across zero through ten under that exact loss function and posterior predictive distribution.

The reference program `resampling_bayes_lab.py` enumerates rather than merely simulates the 70 assignments and 27 bootstrap resamples, and uses SciPy for beta intervals and prediction. The program's numerical output is conditional on the models stated here.
