Lesson map
Lesson 07. Map, example, EX053.
flowchart TD
G["Random 42, 300 baseline draws"] --> D["A success stays only if a second draw is below 0.6"]
D --> B["2000 resamples, then sort"]
B --> C["Read index 50 and index 1949"]
The printed baseline is the realised rate. The 0.30 in the source is not that rate.
Logical drawing
baseline_asr=0.350 defended_asr=0.190 reduction_ci95=[0.120, 0.203]
Learning outcomes
After this chapter, you should be able to:
- Separate the source probability 0.30 from the printed baseline 0.350.
- Point at slots 50 and 1949 in a sorted list of 2000 differences.
- Refuse a note that swaps 0.30 in for 0.350.
7.1 The interval is two positions after the differences are sorted.
random.Random(42) builds 300 baseline draws with r.random() < 0.30. The defended list keeps a baseline success only when a further draw is below 0.6, which is the comment's "about 40 percent blocked" as a design, not as a printed rate. The print then shows sum(base)/300 and sum(defn)/300. Those realised rates are 0.350 and 0.190. Their difference on the original lists is 0.160, and that point difference is not what the bracket prints.
The loop draws 2000 resamples. Each resample picks 300 indexes with replacement, subtracts the defended rate from the baseline rate on those indexes, and appends the difference. After diffs.sort(), the code reads diffs[50] and diffs[1949]. Those two slots print as 0.120 and 0.203. Index 50 is the low end. Index 1949 is the high end. No other slot is printed.
Lesson table; scroll horizontally to read all columns →
| Quantity | Where it lives |
|---|---|
| 0.30 | Bernoulli cutoff for the baseline draws |
| 0.350 | Realised baseline, printed |
| 0.190 | Realised defended rate, printed |
| 0.120 and 0.203 | Slots 50 and 1949 of 2000 |
7.2 Worked example
Lesson table; scroll horizontally to read all columns →
| Offered sentence | Decision |
|---|---|
| "Baseline printed 0.350, not the cutoff 0.30." | Keep |
| "Defended printed 0.190." | Keep |
| "The reduction bracket is 0.120 to 0.203." | Keep |
| "The bracket is the single subtraction 0.160." | Refuse; 0.160 is not a printed end |
Synthetic case. The 300 prompts are draws. They are not Tallis inboxes.
Errors and limits
Treating the source cutoff as the printed baseline invents a column the format string never emitted.
Apply
- EX053 — Two slots. Where do 0.120 and 0.203 come from, and why is 0.350 not 0.30?
Show marking criteria
Rubric: 3 = realised baseline 0.350 and defended 0.190; the bracket is sorted indexes 50 and 1949 of 2000; 0.30 is the draw cutoff;; 2 = the printed rates and the two indexes;; 1 = the rates only;; 0 = replaces 0.350 with 0.30.