Skip to main content

Guided Labs

Download the complete Python lab package, extract it, and open its README. Repository users can work directly in labs/probability-statistics/. Python 3.10+ and its standard library are sufficient; the package runs offline.

Estimated effort: 8–12 hours across four labs, after the relevant theory. These are author estimates, not measured learner times. The supplied reference implementation verifies setup; completion requires your own implementation and written reasoning.

Setup and first check​

Run from the extracted probability-statistics directory:

python check.py --module reference
python run_labs.py --module reference --seed 110 --output results-reference.json

Read README.md for all input contracts. Implement the six functions in starter.py, then run the same commands with --module starter. Unfinished learner functions intentionally fail. Passing the reference checks is not learner completion.

A. Conditioning and stopped retries​

After concepts 1–6 and 10–11, derive a 10,000-request detector table at prevalence .01, sensitivity .9, false-positive rate .05. Derive terminal retry paths for failure probability .05 and three total attempts. Implement posterior and retry_summary.

Acceptance: precision 90/585; expected attempts 1.0525, failures .052625, backoffs .0525, success probability .999875. Explain why a fixed-three-trial binomial model fails and which shared dependency could invalidate independent retries. Repair a denominator mistake using the count table; repair a retry mistake using terminal paths.

B. Sampling without replacement​

After concepts 7–12, implement defect_pmf for a uniform sample from a finite pool. For population10, defects3, draws4, derive [35,105,63,7,0]/210, mean1.2 and variance .56. The checker enumerates small populations independently of your formula.

Acceptance: normalize the PMF, explain its support, and show why a binomial model gets the variance wrong even though its mean agrees. Repair by listing unordered samples for a smaller population before coding again.

C. Averages and simulation​

After concepts 13–15, inspect the runner's independent Exp(1) batches. Compare the mean of means and variance of means with 1 and 1/n at n=1,5,30,100. Run seeds110 and221, keeping both reports. Explain why the fraction of standardized means inside [-1.96,1.96] need not equal .95.

Acceptance: distinguish the LLN, the exact variance identity, and the asymptotic CLT. Derive what happens if each measurement is copied100 times. No numerical closeness threshold can substitute for that explanation. Repair by calculating all covariance terms in the repeated-copy case.

D. Coverage and release decisions​

Implement wilson_interval, exact_coverage, and standardized_mean. The README supplies the Wilson formula; derive why summing binomial masses computes coverage. Compare enumerated and simulated coverage at n=20,p=.01,.1,.5; express differences in simulation-standard-error units.

Acceptance: Wilson upper limit near .161125 at k=0,n=20; raw fixture means A=91,B=21.8 ms; equal-mix means A=55,B=61 ms. Explain nominal versus actual coverage and why the fixture cannot establish causality or a confidence interval for latency. Finish the experiment-design memo.

Submission and review​

Submit starter.py, checker output, both reports, and the completed evidence template. Record assistance, one failed attempt, its correction, and one assumption the code cannot test. Use the assessment rubric for the separate written and transfer checks. If your implementation passes but your explanation uses the wrong sampling unit, that competency remains unfinished.

Continuous models and inference extension​

After Labs A–D, complete the required inference lab. Its four new functions and memo share an additional 8–12 hour allowance included in the extension total; preserve the original six functions and four labs.