
Define what a confidence interval is and why we want to generate one
Explain how the bootstrap sampling distribution can be used to create confidence intervals
Write a computer script to calculate confidence intervals for a population parameter using bootstrapping
Effectively visualize point estimates and confidence intervals
Interpret and explain results from confidence intervals
Discuss the potential limitations of these methods
Define what percentiles are and write a computer script to calculate them

image source: Modern Dive by Ismay & Kim

confidence interval: range from lower to upper
attribution: zoology.ubc.ca/~whitlock/…
Common Misconception: CI as a Probability
It is incorrect to say: “There is a \(95\%\) probability that the population parameter lies within our interval.”
5.0 dkg Coverage: 63.8% (727 / 1140 CIs)
| Sample | Sample Mean (dkg) | Sample | Sample Mean (dkg) | Sample | Sample Mean (dkg) | Sample | Sample Mean (dkg) |
|---|---|---|---|---|---|---|---|
| (#1, #2, #3) | 45.33 | (#1, #2, #4) | 49.33 | (#1, #2, #5) | 37.67 | (#1, #2, #6) | 44.33 |
| (#1, #2, #7) | 43.33 | (#1, #2, #8) | 43.00 | (#1, #2, #9) | 44.00 | (#1, #2, #10) | 49.00 |
| (#1, #2, #11) | 38.33 | (#1, #2, #12) | 45.33 | (#1, #2, #13) | 42.00 | (#1, #2, #14) | 43.67 |
| (#1, #2, #15) | 49.67 | (#1, #2, #16) | 43.67 | (#1, #2, #17) | 41.67 | (#1, #2, #18) | 41.67 |
| (#1, #2, #19) | 50.00 | (#1, #2, #20) | 42.00 | (#1, #3, #4) | 49.67 | (#1, #3, #5) | 38.00 |
| (#1, #3, #6) | 44.67 | (#1, #3, #7) | 43.67 | (#1, #3, #8) | 43.33 | (#1, #3, #9) | 44.33 |
| (#1, #3, #10) | 49.33 | (#1, #3, #11) | 38.67 | (#1, #3, #12) | 45.67 | (#1, #3, #13) | 42.33 |
| (#1, #3, #14) | 44.00 | (#1, #3, #15) | 50.00 | (#1, #3, #16) | 44.00 | (#1, #3, #17) | 42.00 |
| (#1, #3, #18) | 42.00 | (#1, #3, #19) | 50.33 | (#1, #3, #20) | 42.33 | (#1, #4, #5) | 42.00 |
| (#1, #4, #6) | 48.67 | (#1, #4, #7) | 47.67 | (#1, #4, #8) | 47.33 | (#1, #4, #9) | 48.33 |
| (#1, #4, #10) | 53.33 | (#1, #4, #11) | 42.67 | (#1, #4, #12) | 49.67 | (#1, #4, #13) | 46.33 |
| (#1, #4, #14) | 48.00 | (#1, #4, #15) | 54.00 | (#1, #4, #16) | 48.00 | (#1, #4, #17) | 46.00 |
| (#1, #4, #18) | 46.00 | (#1, #4, #19) | 54.33 | (#1, #4, #20) | 46.33 | (#1, #5, #6) | 37.00 |
| (#1, #5, #7) | 36.00 | (#1, #5, #8) | 35.67 | (#1, #5, #9) | 36.67 | (#1, #5, #10) | 41.67 |
| (#1, #5, #11) | 31.00 | (#1, #5, #12) | 38.00 | (#1, #5, #13) | 34.67 | (#1, #5, #14) | 36.33 |
| (#1, #5, #15) | 42.33 | (#1, #5, #16) | 36.33 | (#1, #5, #17) | 34.33 | (#1, #5, #18) | 34.33 |
| (#1, #5, #19) | 42.67 | (#1, #5, #20) | 34.67 | (#1, #6, #7) | 42.67 | (#1, #6, #8) | 42.33 |
| (#1, #6, #9) | 43.33 | (#1, #6, #10) | 48.33 | (#1, #6, #11) | 37.67 | (#1, #6, #12) | 44.67 |
| (#1, #6, #13) | 41.33 | (#1, #6, #14) | 43.00 | (#1, #6, #15) | 49.00 | (#1, #6, #16) | 43.00 |
| (#1, #6, #17) | 41.00 | (#1, #6, #18) | 41.00 | (#1, #6, #19) | 49.33 | (#1, #6, #20) | 41.33 |
| (#1, #7, #8) | 41.33 | (#1, #7, #9) | 42.33 | (#1, #7, #10) | 47.33 | (#1, #7, #11) | 36.67 |
| (#1, #7, #12) | 43.67 | (#1, #7, #13) | 40.33 | (#1, #7, #14) | 42.00 | (#1, #7, #15) | 48.00 |
| (#1, #7, #16) | 42.00 | (#1, #7, #17) | 40.00 | (#1, #7, #18) | 40.00 | (#1, #7, #19) | 48.33 |
| (#1, #7, #20) | 40.33 | (#1, #8, #9) | 42.00 | (#1, #8, #10) | 47.00 | (#1, #8, #11) | 36.33 |
| (#1, #8, #12) | 43.33 | (#1, #8, #13) | 40.00 | (#1, #8, #14) | 41.67 | (#1, #8, #15) | 47.67 |
| (#1, #8, #16) | 41.67 | (#1, #8, #17) | 39.67 | (#1, #8, #18) | 39.67 | (#1, #8, #19) | 48.00 |
| (#1, #8, #20) | 40.00 | (#1, #9, #10) | 48.00 | (#1, #9, #11) | 37.33 | (#1, #9, #12) | 44.33 |
| (#1, #9, #13) | 41.00 | (#1, #9, #14) | 42.67 | (#1, #9, #15) | 48.67 | (#1, #9, #16) | 42.67 |
| (#1, #9, #17) | 40.67 | (#1, #9, #18) | 40.67 | (#1, #9, #19) | 49.00 | (#1, #9, #20) | 41.00 |
| (#1, #10, #11) | 42.33 | (#1, #10, #12) | 49.33 | (#1, #10, #13) | 46.00 | (#1, #10, #14) | 47.67 |
| (#1, #10, #15) | 53.67 | (#1, #10, #16) | 47.67 | (#1, #10, #17) | 45.67 | (#1, #10, #18) | 45.67 |
| (#1, #10, #19) | 54.00 | (#1, #10, #20) | 46.00 | (#1, #11, #12) | 38.67 | (#1, #11, #13) | 35.33 |
| (#1, #11, #14) | 37.00 | (#1, #11, #15) | 43.00 | (#1, #11, #16) | 37.00 | (#1, #11, #17) | 35.00 |
| (#1, #11, #18) | 35.00 | (#1, #11, #19) | 43.33 | (#1, #11, #20) | 35.33 | (#1, #12, #13) | 42.33 |
| (#1, #12, #14) | 44.00 | (#1, #12, #15) | 50.00 | (#1, #12, #16) | 44.00 | (#1, #12, #17) | 42.00 |
| (#1, #12, #18) | 42.00 | (#1, #12, #19) | 50.33 | (#1, #12, #20) | 42.33 | (#1, #13, #14) | 40.67 |
| (#1, #13, #15) | 46.67 | (#1, #13, #16) | 40.67 | (#1, #13, #17) | 38.67 | (#1, #13, #18) | 38.67 |
| (#1, #13, #19) | 47.00 | (#1, #13, #20) | 39.00 | (#1, #14, #15) | 48.33 | (#1, #14, #16) | 42.33 |
| (#1, #14, #17) | 40.33 | (#1, #14, #18) | 40.33 | (#1, #14, #19) | 48.67 | (#1, #14, #20) | 40.67 |
| (#1, #15, #16) | 48.33 | (#1, #15, #17) | 46.33 | (#1, #15, #18) | 46.33 | (#1, #15, #19) | 54.67 |
| (#1, #15, #20) | 46.67 | (#1, #16, #17) | 40.33 | (#1, #16, #18) | 40.33 | (#1, #16, #19) | 48.67 |
| (#1, #16, #20) | 40.67 | (#1, #17, #18) | 38.33 | (#1, #17, #19) | 46.67 | (#1, #17, #20) | 38.67 |
| (#1, #18, #19) | 46.67 | (#1, #18, #20) | 38.67 | (#1, #19, #20) | 47.00 | (#2, #3, #4) | 50.67 |
| (#2, #3, #5) | 39.00 | (#2, #3, #6) | 45.67 | (#2, #3, #7) | 44.67 | (#2, #3, #8) | 44.33 |
| (#2, #3, #9) | 45.33 | (#2, #3, #10) | 50.33 | (#2, #3, #11) | 39.67 | (#2, #3, #12) | 46.67 |
| (#2, #3, #13) | 43.33 | (#2, #3, #14) | 45.00 | (#2, #3, #15) | 51.00 | (#2, #3, #16) | 45.00 |
| (#2, #3, #17) | 43.00 | (#2, #3, #18) | 43.00 | (#2, #3, #19) | 51.33 | (#2, #3, #20) | 43.33 |
| (#2, #4, #5) | 43.00 | (#2, #4, #6) | 49.67 | (#2, #4, #7) | 48.67 | (#2, #4, #8) | 48.33 |
| (#2, #4, #9) | 49.33 | (#2, #4, #10) | 54.33 | (#2, #4, #11) | 43.67 | (#2, #4, #12) | 50.67 |
| (#2, #4, #13) | 47.33 | (#2, #4, #14) | 49.00 | (#2, #4, #15) | 55.00 | (#2, #4, #16) | 49.00 |
| (#2, #4, #17) | 47.00 | (#2, #4, #18) | 47.00 | (#2, #4, #19) | 55.33 | (#2, #4, #20) | 47.33 |
| (#2, #5, #6) | 38.00 | (#2, #5, #7) | 37.00 | (#2, #5, #8) | 36.67 | (#2, #5, #9) | 37.67 |
| (#2, #5, #10) | 42.67 | (#2, #5, #11) | 32.00 | (#2, #5, #12) | 39.00 | (#2, #5, #13) | 35.67 |
| (#2, #5, #14) | 37.33 | (#2, #5, #15) | 43.33 | (#2, #5, #16) | 37.33 | (#2, #5, #17) | 35.33 |
| (#2, #5, #18) | 35.33 | (#2, #5, #19) | 43.67 | (#2, #5, #20) | 35.67 | (#2, #6, #7) | 43.67 |
| (#2, #6, #8) | 43.33 | (#2, #6, #9) | 44.33 | (#2, #6, #10) | 49.33 | (#2, #6, #11) | 38.67 |
| (#2, #6, #12) | 45.67 | (#2, #6, #13) | 42.33 | (#2, #6, #14) | 44.00 | (#2, #6, #15) | 50.00 |
| (#2, #6, #16) | 44.00 | (#2, #6, #17) | 42.00 | (#2, #6, #18) | 42.00 | (#2, #6, #19) | 50.33 |
| (#2, #6, #20) | 42.33 | (#2, #7, #8) | 42.33 | (#2, #7, #9) | 43.33 | (#2, #7, #10) | 48.33 |
| (#2, #7, #11) | 37.67 | (#2, #7, #12) | 44.67 | (#2, #7, #13) | 41.33 | (#2, #7, #14) | 43.00 |
| (#2, #7, #15) | 49.00 | (#2, #7, #16) | 43.00 | (#2, #7, #17) | 41.00 | (#2, #7, #18) | 41.00 |
| (#2, #7, #19) | 49.33 | (#2, #7, #20) | 41.33 | (#2, #8, #9) | 43.00 | (#2, #8, #10) | 48.00 |
| (#2, #8, #11) | 37.33 | (#2, #8, #12) | 44.33 | (#2, #8, #13) | 41.00 | (#2, #8, #14) | 42.67 |
| (#2, #8, #15) | 48.67 | (#2, #8, #16) | 42.67 | (#2, #8, #17) | 40.67 | (#2, #8, #18) | 40.67 |
| (#2, #8, #19) | 49.00 | (#2, #8, #20) | 41.00 | (#2, #9, #10) | 49.00 | (#2, #9, #11) | 38.33 |
| (#2, #9, #12) | 45.33 | (#2, #9, #13) | 42.00 | (#2, #9, #14) | 43.67 | (#2, #9, #15) | 49.67 |
| (#2, #9, #16) | 43.67 | (#2, #9, #17) | 41.67 | (#2, #9, #18) | 41.67 | (#2, #9, #19) | 50.00 |
| (#2, #9, #20) | 42.00 | (#2, #10, #11) | 43.33 | (#2, #10, #12) | 50.33 | (#2, #10, #13) | 47.00 |
| (#2, #10, #14) | 48.67 | (#2, #10, #15) | 54.67 | (#2, #10, #16) | 48.67 | (#2, #10, #17) | 46.67 |
| (#2, #10, #18) | 46.67 | (#2, #10, #19) | 55.00 | (#2, #10, #20) | 47.00 | (#2, #11, #12) | 39.67 |
| (#2, #11, #13) | 36.33 | (#2, #11, #14) | 38.00 | (#2, #11, #15) | 44.00 | (#2, #11, #16) | 38.00 |
| (#2, #11, #17) | 36.00 | (#2, #11, #18) | 36.00 | (#2, #11, #19) | 44.33 | (#2, #11, #20) | 36.33 |
| (#2, #12, #13) | 43.33 | (#2, #12, #14) | 45.00 | (#2, #12, #15) | 51.00 | (#2, #12, #16) | 45.00 |
| (#2, #12, #17) | 43.00 | (#2, #12, #18) | 43.00 | (#2, #12, #19) | 51.33 | (#2, #12, #20) | 43.33 |
| (#2, #13, #14) | 41.67 | (#2, #13, #15) | 47.67 | (#2, #13, #16) | 41.67 | (#2, #13, #17) | 39.67 |
| (#2, #13, #18) | 39.67 | (#2, #13, #19) | 48.00 | (#2, #13, #20) | 40.00 | (#2, #14, #15) | 49.33 |
| (#2, #14, #16) | 43.33 | (#2, #14, #17) | 41.33 | (#2, #14, #18) | 41.33 | (#2, #14, #19) | 49.67 |
| (#2, #14, #20) | 41.67 | (#2, #15, #16) | 49.33 | (#2, #15, #17) | 47.33 | (#2, #15, #18) | 47.33 |
| (#2, #15, #19) | 55.67 | (#2, #15, #20) | 47.67 | (#2, #16, #17) | 41.33 | (#2, #16, #18) | 41.33 |
| (#2, #16, #19) | 49.67 | (#2, #16, #20) | 41.67 | (#2, #17, #18) | 39.33 | (#2, #17, #19) | 47.67 |
| (#2, #17, #20) | 39.67 | (#2, #18, #19) | 47.67 | (#2, #18, #20) | 39.67 | (#2, #19, #20) | 48.00 |
| (#3, #4, #5) | 43.33 | (#3, #4, #6) | 50.00 | (#3, #4, #7) | 49.00 | (#3, #4, #8) | 48.67 |
| (#3, #4, #9) | 49.67 | (#3, #4, #10) | 54.67 | (#3, #4, #11) | 44.00 | (#3, #4, #12) | 51.00 |
| (#3, #4, #13) | 47.67 | (#3, #4, #14) | 49.33 | (#3, #4, #15) | 55.33 | (#3, #4, #16) | 49.33 |
| (#3, #4, #17) | 47.33 | (#3, #4, #18) | 47.33 | (#3, #4, #19) | 55.67 | (#3, #4, #20) | 47.67 |
| (#3, #5, #6) | 38.33 | (#3, #5, #7) | 37.33 | (#3, #5, #8) | 37.00 | (#3, #5, #9) | 38.00 |
| (#3, #5, #10) | 43.00 | (#3, #5, #11) | 32.33 | (#3, #5, #12) | 39.33 | (#3, #5, #13) | 36.00 |
| (#3, #5, #14) | 37.67 | (#3, #5, #15) | 43.67 | (#3, #5, #16) | 37.67 | (#3, #5, #17) | 35.67 |
| (#3, #5, #18) | 35.67 | (#3, #5, #19) | 44.00 | (#3, #5, #20) | 36.00 | (#3, #6, #7) | 44.00 |
| (#3, #6, #8) | 43.67 | (#3, #6, #9) | 44.67 | (#3, #6, #10) | 49.67 | (#3, #6, #11) | 39.00 |
| (#3, #6, #12) | 46.00 | (#3, #6, #13) | 42.67 | (#3, #6, #14) | 44.33 | (#3, #6, #15) | 50.33 |
| (#3, #6, #16) | 44.33 | (#3, #6, #17) | 42.33 | (#3, #6, #18) | 42.33 | (#3, #6, #19) | 50.67 |
| (#3, #6, #20) | 42.67 | (#3, #7, #8) | 42.67 | (#3, #7, #9) | 43.67 | (#3, #7, #10) | 48.67 |
| (#3, #7, #11) | 38.00 | (#3, #7, #12) | 45.00 | (#3, #7, #13) | 41.67 | (#3, #7, #14) | 43.33 |
| (#3, #7, #15) | 49.33 | (#3, #7, #16) | 43.33 | (#3, #7, #17) | 41.33 | (#3, #7, #18) | 41.33 |
| (#3, #7, #19) | 49.67 | (#3, #7, #20) | 41.67 | (#3, #8, #9) | 43.33 | (#3, #8, #10) | 48.33 |
| (#3, #8, #11) | 37.67 | (#3, #8, #12) | 44.67 | (#3, #8, #13) | 41.33 | (#3, #8, #14) | 43.00 |
| (#3, #8, #15) | 49.00 | (#3, #8, #16) | 43.00 | (#3, #8, #17) | 41.00 | (#3, #8, #18) | 41.00 |
| (#3, #8, #19) | 49.33 | (#3, #8, #20) | 41.33 | (#3, #9, #10) | 49.33 | (#3, #9, #11) | 38.67 |
| (#3, #9, #12) | 45.67 | (#3, #9, #13) | 42.33 | (#3, #9, #14) | 44.00 | (#3, #9, #15) | 50.00 |
| (#3, #9, #16) | 44.00 | (#3, #9, #17) | 42.00 | (#3, #9, #18) | 42.00 | (#3, #9, #19) | 50.33 |
| (#3, #9, #20) | 42.33 | (#3, #10, #11) | 43.67 | (#3, #10, #12) | 50.67 | (#3, #10, #13) | 47.33 |
| (#3, #10, #14) | 49.00 | (#3, #10, #15) | 55.00 | (#3, #10, #16) | 49.00 | (#3, #10, #17) | 47.00 |
| (#3, #10, #18) | 47.00 | (#3, #10, #19) | 55.33 | (#3, #10, #20) | 47.33 | (#3, #11, #12) | 40.00 |
| (#3, #11, #13) | 36.67 | (#3, #11, #14) | 38.33 | (#3, #11, #15) | 44.33 | (#3, #11, #16) | 38.33 |
| (#3, #11, #17) | 36.33 | (#3, #11, #18) | 36.33 | (#3, #11, #19) | 44.67 | (#3, #11, #20) | 36.67 |
| (#3, #12, #13) | 43.67 | (#3, #12, #14) | 45.33 | (#3, #12, #15) | 51.33 | (#3, #12, #16) | 45.33 |
| (#3, #12, #17) | 43.33 | (#3, #12, #18) | 43.33 | (#3, #12, #19) | 51.67 | (#3, #12, #20) | 43.67 |
| (#3, #13, #14) | 42.00 | (#3, #13, #15) | 48.00 | (#3, #13, #16) | 42.00 | (#3, #13, #17) | 40.00 |
| (#3, #13, #18) | 40.00 | (#3, #13, #19) | 48.33 | (#3, #13, #20) | 40.33 | (#3, #14, #15) | 49.67 |
| (#3, #14, #16) | 43.67 | (#3, #14, #17) | 41.67 | (#3, #14, #18) | 41.67 | (#3, #14, #19) | 50.00 |
| (#3, #14, #20) | 42.00 | (#3, #15, #16) | 49.67 | (#3, #15, #17) | 47.67 | (#3, #15, #18) | 47.67 |
| (#3, #15, #19) | 56.00 | (#3, #15, #20) | 48.00 | (#3, #16, #17) | 41.67 | (#3, #16, #18) | 41.67 |
| (#3, #16, #19) | 50.00 | (#3, #16, #20) | 42.00 | (#3, #17, #18) | 39.67 | (#3, #17, #19) | 48.00 |
| (#3, #17, #20) | 40.00 | (#3, #18, #19) | 48.00 | (#3, #18, #20) | 40.00 | (#3, #19, #20) | 48.33 |
| (#4, #5, #6) | 42.33 | (#4, #5, #7) | 41.33 | (#4, #5, #8) | 41.00 | (#4, #5, #9) | 42.00 |
| (#4, #5, #10) | 47.00 | (#4, #5, #11) | 36.33 | (#4, #5, #12) | 43.33 | (#4, #5, #13) | 40.00 |
| (#4, #5, #14) | 41.67 | (#4, #5, #15) | 47.67 | (#4, #5, #16) | 41.67 | (#4, #5, #17) | 39.67 |
| (#4, #5, #18) | 39.67 | (#4, #5, #19) | 48.00 | (#4, #5, #20) | 40.00 | (#4, #6, #7) | 48.00 |
| (#4, #6, #8) | 47.67 | (#4, #6, #9) | 48.67 | (#4, #6, #10) | 53.67 | (#4, #6, #11) | 43.00 |
| (#4, #6, #12) | 50.00 | (#4, #6, #13) | 46.67 | (#4, #6, #14) | 48.33 | (#4, #6, #15) | 54.33 |
| (#4, #6, #16) | 48.33 | (#4, #6, #17) | 46.33 | (#4, #6, #18) | 46.33 | (#4, #6, #19) | 54.67 |
| (#4, #6, #20) | 46.67 | (#4, #7, #8) | 46.67 | (#4, #7, #9) | 47.67 | (#4, #7, #10) | 52.67 |
| (#4, #7, #11) | 42.00 | (#4, #7, #12) | 49.00 | (#4, #7, #13) | 45.67 | (#4, #7, #14) | 47.33 |
| (#4, #7, #15) | 53.33 | (#4, #7, #16) | 47.33 | (#4, #7, #17) | 45.33 | (#4, #7, #18) | 45.33 |
| (#4, #7, #19) | 53.67 | (#4, #7, #20) | 45.67 | (#4, #8, #9) | 47.33 | (#4, #8, #10) | 52.33 |
| (#4, #8, #11) | 41.67 | (#4, #8, #12) | 48.67 | (#4, #8, #13) | 45.33 | (#4, #8, #14) | 47.00 |
| (#4, #8, #15) | 53.00 | (#4, #8, #16) | 47.00 | (#4, #8, #17) | 45.00 | (#4, #8, #18) | 45.00 |
| (#4, #8, #19) | 53.33 | (#4, #8, #20) | 45.33 | (#4, #9, #10) | 53.33 | (#4, #9, #11) | 42.67 |
| (#4, #9, #12) | 49.67 | (#4, #9, #13) | 46.33 | (#4, #9, #14) | 48.00 | (#4, #9, #15) | 54.00 |
| (#4, #9, #16) | 48.00 | (#4, #9, #17) | 46.00 | (#4, #9, #18) | 46.00 | (#4, #9, #19) | 54.33 |
| (#4, #9, #20) | 46.33 | (#4, #10, #11) | 47.67 | (#4, #10, #12) | 54.67 | (#4, #10, #13) | 51.33 |
| (#4, #10, #14) | 53.00 | (#4, #10, #15) | 59.00 | (#4, #10, #16) | 53.00 | (#4, #10, #17) | 51.00 |
| (#4, #10, #18) | 51.00 | (#4, #10, #19) | 59.33 | (#4, #10, #20) | 51.33 | (#4, #11, #12) | 44.00 |
| (#4, #11, #13) | 40.67 | (#4, #11, #14) | 42.33 | (#4, #11, #15) | 48.33 | (#4, #11, #16) | 42.33 |
| (#4, #11, #17) | 40.33 | (#4, #11, #18) | 40.33 | (#4, #11, #19) | 48.67 | (#4, #11, #20) | 40.67 |
| (#4, #12, #13) | 47.67 | (#4, #12, #14) | 49.33 | (#4, #12, #15) | 55.33 | (#4, #12, #16) | 49.33 |
| (#4, #12, #17) | 47.33 | (#4, #12, #18) | 47.33 | (#4, #12, #19) | 55.67 | (#4, #12, #20) | 47.67 |
| (#4, #13, #14) | 46.00 | (#4, #13, #15) | 52.00 | (#4, #13, #16) | 46.00 | (#4, #13, #17) | 44.00 |
| (#4, #13, #18) | 44.00 | (#4, #13, #19) | 52.33 | (#4, #13, #20) | 44.33 | (#4, #14, #15) | 53.67 |
| (#4, #14, #16) | 47.67 | (#4, #14, #17) | 45.67 | (#4, #14, #18) | 45.67 | (#4, #14, #19) | 54.00 |
| (#4, #14, #20) | 46.00 | (#4, #15, #16) | 53.67 | (#4, #15, #17) | 51.67 | (#4, #15, #18) | 51.67 |
| (#4, #15, #19) | 60.00 | (#4, #15, #20) | 52.00 | (#4, #16, #17) | 45.67 | (#4, #16, #18) | 45.67 |
| (#4, #16, #19) | 54.00 | (#4, #16, #20) | 46.00 | (#4, #17, #18) | 43.67 | (#4, #17, #19) | 52.00 |
| (#4, #17, #20) | 44.00 | (#4, #18, #19) | 52.00 | (#4, #18, #20) | 44.00 | (#4, #19, #20) | 52.33 |
| (#5, #6, #7) | 36.33 | (#5, #6, #8) | 36.00 | (#5, #6, #9) | 37.00 | (#5, #6, #10) | 42.00 |
| (#5, #6, #11) | 31.33 | (#5, #6, #12) | 38.33 | (#5, #6, #13) | 35.00 | (#5, #6, #14) | 36.67 |
| (#5, #6, #15) | 42.67 | (#5, #6, #16) | 36.67 | (#5, #6, #17) | 34.67 | (#5, #6, #18) | 34.67 |
| (#5, #6, #19) | 43.00 | (#5, #6, #20) | 35.00 | (#5, #7, #8) | 35.00 | (#5, #7, #9) | 36.00 |
| (#5, #7, #10) | 41.00 | (#5, #7, #11) | 30.33 | (#5, #7, #12) | 37.33 | (#5, #7, #13) | 34.00 |
| (#5, #7, #14) | 35.67 | (#5, #7, #15) | 41.67 | (#5, #7, #16) | 35.67 | (#5, #7, #17) | 33.67 |
| (#5, #7, #18) | 33.67 | (#5, #7, #19) | 42.00 | (#5, #7, #20) | 34.00 | (#5, #8, #9) | 35.67 |
| (#5, #8, #10) | 40.67 | (#5, #8, #11) | 30.00 | (#5, #8, #12) | 37.00 | (#5, #8, #13) | 33.67 |
| (#5, #8, #14) | 35.33 | (#5, #8, #15) | 41.33 | (#5, #8, #16) | 35.33 | (#5, #8, #17) | 33.33 |
| (#5, #8, #18) | 33.33 | (#5, #8, #19) | 41.67 | (#5, #8, #20) | 33.67 | (#5, #9, #10) | 41.67 |
| (#5, #9, #11) | 31.00 | (#5, #9, #12) | 38.00 | (#5, #9, #13) | 34.67 | (#5, #9, #14) | 36.33 |
| (#5, #9, #15) | 42.33 | (#5, #9, #16) | 36.33 | (#5, #9, #17) | 34.33 | (#5, #9, #18) | 34.33 |
| (#5, #9, #19) | 42.67 | (#5, #9, #20) | 34.67 | (#5, #10, #11) | 36.00 | (#5, #10, #12) | 43.00 |
| (#5, #10, #13) | 39.67 | (#5, #10, #14) | 41.33 | (#5, #10, #15) | 47.33 | (#5, #10, #16) | 41.33 |
| (#5, #10, #17) | 39.33 | (#5, #10, #18) | 39.33 | (#5, #10, #19) | 47.67 | (#5, #10, #20) | 39.67 |
| (#5, #11, #12) | 32.33 | (#5, #11, #13) | 29.00 | (#5, #11, #14) | 30.67 | (#5, #11, #15) | 36.67 |
| (#5, #11, #16) | 30.67 | (#5, #11, #17) | 28.67 | (#5, #11, #18) | 28.67 | (#5, #11, #19) | 37.00 |
| (#5, #11, #20) | 29.00 | (#5, #12, #13) | 36.00 | (#5, #12, #14) | 37.67 | (#5, #12, #15) | 43.67 |
| (#5, #12, #16) | 37.67 | (#5, #12, #17) | 35.67 | (#5, #12, #18) | 35.67 | (#5, #12, #19) | 44.00 |
| (#5, #12, #20) | 36.00 | (#5, #13, #14) | 34.33 | (#5, #13, #15) | 40.33 | (#5, #13, #16) | 34.33 |
| (#5, #13, #17) | 32.33 | (#5, #13, #18) | 32.33 | (#5, #13, #19) | 40.67 | (#5, #13, #20) | 32.67 |
| (#5, #14, #15) | 42.00 | (#5, #14, #16) | 36.00 | (#5, #14, #17) | 34.00 | (#5, #14, #18) | 34.00 |
| (#5, #14, #19) | 42.33 | (#5, #14, #20) | 34.33 | (#5, #15, #16) | 42.00 | (#5, #15, #17) | 40.00 |
| (#5, #15, #18) | 40.00 | (#5, #15, #19) | 48.33 | (#5, #15, #20) | 40.33 | (#5, #16, #17) | 34.00 |
| (#5, #16, #18) | 34.00 | (#5, #16, #19) | 42.33 | (#5, #16, #20) | 34.33 | (#5, #17, #18) | 32.00 |
| (#5, #17, #19) | 40.33 | (#5, #17, #20) | 32.33 | (#5, #18, #19) | 40.33 | (#5, #18, #20) | 32.33 |
| (#5, #19, #20) | 40.67 | (#6, #7, #8) | 41.67 | (#6, #7, #9) | 42.67 | (#6, #7, #10) | 47.67 |
| (#6, #7, #11) | 37.00 | (#6, #7, #12) | 44.00 | (#6, #7, #13) | 40.67 | (#6, #7, #14) | 42.33 |
| (#6, #7, #15) | 48.33 | (#6, #7, #16) | 42.33 | (#6, #7, #17) | 40.33 | (#6, #7, #18) | 40.33 |
| (#6, #7, #19) | 48.67 | (#6, #7, #20) | 40.67 | (#6, #8, #9) | 42.33 | (#6, #8, #10) | 47.33 |
| (#6, #8, #11) | 36.67 | (#6, #8, #12) | 43.67 | (#6, #8, #13) | 40.33 | (#6, #8, #14) | 42.00 |
| (#6, #8, #15) | 48.00 | (#6, #8, #16) | 42.00 | (#6, #8, #17) | 40.00 | (#6, #8, #18) | 40.00 |
| (#6, #8, #19) | 48.33 | (#6, #8, #20) | 40.33 | (#6, #9, #10) | 48.33 | (#6, #9, #11) | 37.67 |
| (#6, #9, #12) | 44.67 | (#6, #9, #13) | 41.33 | (#6, #9, #14) | 43.00 | (#6, #9, #15) | 49.00 |
| (#6, #9, #16) | 43.00 | (#6, #9, #17) | 41.00 | (#6, #9, #18) | 41.00 | (#6, #9, #19) | 49.33 |
| (#6, #9, #20) | 41.33 | (#6, #10, #11) | 42.67 | (#6, #10, #12) | 49.67 | (#6, #10, #13) | 46.33 |
| (#6, #10, #14) | 48.00 | (#6, #10, #15) | 54.00 | (#6, #10, #16) | 48.00 | (#6, #10, #17) | 46.00 |
| (#6, #10, #18) | 46.00 | (#6, #10, #19) | 54.33 | (#6, #10, #20) | 46.33 | (#6, #11, #12) | 39.00 |
| (#6, #11, #13) | 35.67 | (#6, #11, #14) | 37.33 | (#6, #11, #15) | 43.33 | (#6, #11, #16) | 37.33 |
| (#6, #11, #17) | 35.33 | (#6, #11, #18) | 35.33 | (#6, #11, #19) | 43.67 | (#6, #11, #20) | 35.67 |
| (#6, #12, #13) | 42.67 | (#6, #12, #14) | 44.33 | (#6, #12, #15) | 50.33 | (#6, #12, #16) | 44.33 |
| (#6, #12, #17) | 42.33 | (#6, #12, #18) | 42.33 | (#6, #12, #19) | 50.67 | (#6, #12, #20) | 42.67 |
| (#6, #13, #14) | 41.00 | (#6, #13, #15) | 47.00 | (#6, #13, #16) | 41.00 | (#6, #13, #17) | 39.00 |
| (#6, #13, #18) | 39.00 | (#6, #13, #19) | 47.33 | (#6, #13, #20) | 39.33 | (#6, #14, #15) | 48.67 |
| (#6, #14, #16) | 42.67 | (#6, #14, #17) | 40.67 | (#6, #14, #18) | 40.67 | (#6, #14, #19) | 49.00 |
| (#6, #14, #20) | 41.00 | (#6, #15, #16) | 48.67 | (#6, #15, #17) | 46.67 | (#6, #15, #18) | 46.67 |
| (#6, #15, #19) | 55.00 | (#6, #15, #20) | 47.00 | (#6, #16, #17) | 40.67 | (#6, #16, #18) | 40.67 |
| (#6, #16, #19) | 49.00 | (#6, #16, #20) | 41.00 | (#6, #17, #18) | 38.67 | (#6, #17, #19) | 47.00 |
| (#6, #17, #20) | 39.00 | (#6, #18, #19) | 47.00 | (#6, #18, #20) | 39.00 | (#6, #19, #20) | 47.33 |
| (#7, #8, #9) | 41.33 | (#7, #8, #10) | 46.33 | (#7, #8, #11) | 35.67 | (#7, #8, #12) | 42.67 |
| (#7, #8, #13) | 39.33 | (#7, #8, #14) | 41.00 | (#7, #8, #15) | 47.00 | (#7, #8, #16) | 41.00 |
| (#7, #8, #17) | 39.00 | (#7, #8, #18) | 39.00 | (#7, #8, #19) | 47.33 | (#7, #8, #20) | 39.33 |
| (#7, #9, #10) | 47.33 | (#7, #9, #11) | 36.67 | (#7, #9, #12) | 43.67 | (#7, #9, #13) | 40.33 |
| (#7, #9, #14) | 42.00 | (#7, #9, #15) | 48.00 | (#7, #9, #16) | 42.00 | (#7, #9, #17) | 40.00 |
| (#7, #9, #18) | 40.00 | (#7, #9, #19) | 48.33 | (#7, #9, #20) | 40.33 | (#7, #10, #11) | 41.67 |
| (#7, #10, #12) | 48.67 | (#7, #10, #13) | 45.33 | (#7, #10, #14) | 47.00 | (#7, #10, #15) | 53.00 |
| (#7, #10, #16) | 47.00 | (#7, #10, #17) | 45.00 | (#7, #10, #18) | 45.00 | (#7, #10, #19) | 53.33 |
| (#7, #10, #20) | 45.33 | (#7, #11, #12) | 38.00 | (#7, #11, #13) | 34.67 | (#7, #11, #14) | 36.33 |
| (#7, #11, #15) | 42.33 | (#7, #11, #16) | 36.33 | (#7, #11, #17) | 34.33 | (#7, #11, #18) | 34.33 |
| (#7, #11, #19) | 42.67 | (#7, #11, #20) | 34.67 | (#7, #12, #13) | 41.67 | (#7, #12, #14) | 43.33 |
| (#7, #12, #15) | 49.33 | (#7, #12, #16) | 43.33 | (#7, #12, #17) | 41.33 | (#7, #12, #18) | 41.33 |
| (#7, #12, #19) | 49.67 | (#7, #12, #20) | 41.67 | (#7, #13, #14) | 40.00 | (#7, #13, #15) | 46.00 |
| (#7, #13, #16) | 40.00 | (#7, #13, #17) | 38.00 | (#7, #13, #18) | 38.00 | (#7, #13, #19) | 46.33 |
| (#7, #13, #20) | 38.33 | (#7, #14, #15) | 47.67 | (#7, #14, #16) | 41.67 | (#7, #14, #17) | 39.67 |
| (#7, #14, #18) | 39.67 | (#7, #14, #19) | 48.00 | (#7, #14, #20) | 40.00 | (#7, #15, #16) | 47.67 |
| (#7, #15, #17) | 45.67 | (#7, #15, #18) | 45.67 | (#7, #15, #19) | 54.00 | (#7, #15, #20) | 46.00 |
| (#7, #16, #17) | 39.67 | (#7, #16, #18) | 39.67 | (#7, #16, #19) | 48.00 | (#7, #16, #20) | 40.00 |
| (#7, #17, #18) | 37.67 | (#7, #17, #19) | 46.00 | (#7, #17, #20) | 38.00 | (#7, #18, #19) | 46.00 |
| (#7, #18, #20) | 38.00 | (#7, #19, #20) | 46.33 | (#8, #9, #10) | 47.00 | (#8, #9, #11) | 36.33 |
| (#8, #9, #12) | 43.33 | (#8, #9, #13) | 40.00 | (#8, #9, #14) | 41.67 | (#8, #9, #15) | 47.67 |
| (#8, #9, #16) | 41.67 | (#8, #9, #17) | 39.67 | (#8, #9, #18) | 39.67 | (#8, #9, #19) | 48.00 |
| (#8, #9, #20) | 40.00 | (#8, #10, #11) | 41.33 | (#8, #10, #12) | 48.33 | (#8, #10, #13) | 45.00 |
| (#8, #10, #14) | 46.67 | (#8, #10, #15) | 52.67 | (#8, #10, #16) | 46.67 | (#8, #10, #17) | 44.67 |
| (#8, #10, #18) | 44.67 | (#8, #10, #19) | 53.00 | (#8, #10, #20) | 45.00 | (#8, #11, #12) | 37.67 |
| (#8, #11, #13) | 34.33 | (#8, #11, #14) | 36.00 | (#8, #11, #15) | 42.00 | (#8, #11, #16) | 36.00 |
| (#8, #11, #17) | 34.00 | (#8, #11, #18) | 34.00 | (#8, #11, #19) | 42.33 | (#8, #11, #20) | 34.33 |
| (#8, #12, #13) | 41.33 | (#8, #12, #14) | 43.00 | (#8, #12, #15) | 49.00 | (#8, #12, #16) | 43.00 |
| (#8, #12, #17) | 41.00 | (#8, #12, #18) | 41.00 | (#8, #12, #19) | 49.33 | (#8, #12, #20) | 41.33 |
| (#8, #13, #14) | 39.67 | (#8, #13, #15) | 45.67 | (#8, #13, #16) | 39.67 | (#8, #13, #17) | 37.67 |
| (#8, #13, #18) | 37.67 | (#8, #13, #19) | 46.00 | (#8, #13, #20) | 38.00 | (#8, #14, #15) | 47.33 |
| (#8, #14, #16) | 41.33 | (#8, #14, #17) | 39.33 | (#8, #14, #18) | 39.33 | (#8, #14, #19) | 47.67 |
| (#8, #14, #20) | 39.67 | (#8, #15, #16) | 47.33 | (#8, #15, #17) | 45.33 | (#8, #15, #18) | 45.33 |
| (#8, #15, #19) | 53.67 | (#8, #15, #20) | 45.67 | (#8, #16, #17) | 39.33 | (#8, #16, #18) | 39.33 |
| (#8, #16, #19) | 47.67 | (#8, #16, #20) | 39.67 | (#8, #17, #18) | 37.33 | (#8, #17, #19) | 45.67 |
| (#8, #17, #20) | 37.67 | (#8, #18, #19) | 45.67 | (#8, #18, #20) | 37.67 | (#8, #19, #20) | 46.00 |
| (#9, #10, #11) | 42.33 | (#9, #10, #12) | 49.33 | (#9, #10, #13) | 46.00 | (#9, #10, #14) | 47.67 |
| (#9, #10, #15) | 53.67 | (#9, #10, #16) | 47.67 | (#9, #10, #17) | 45.67 | (#9, #10, #18) | 45.67 |
| (#9, #10, #19) | 54.00 | (#9, #10, #20) | 46.00 | (#9, #11, #12) | 38.67 | (#9, #11, #13) | 35.33 |
| (#9, #11, #14) | 37.00 | (#9, #11, #15) | 43.00 | (#9, #11, #16) | 37.00 | (#9, #11, #17) | 35.00 |
| (#9, #11, #18) | 35.00 | (#9, #11, #19) | 43.33 | (#9, #11, #20) | 35.33 | (#9, #12, #13) | 42.33 |
| (#9, #12, #14) | 44.00 | (#9, #12, #15) | 50.00 | (#9, #12, #16) | 44.00 | (#9, #12, #17) | 42.00 |
| (#9, #12, #18) | 42.00 | (#9, #12, #19) | 50.33 | (#9, #12, #20) | 42.33 | (#9, #13, #14) | 40.67 |
| (#9, #13, #15) | 46.67 | (#9, #13, #16) | 40.67 | (#9, #13, #17) | 38.67 | (#9, #13, #18) | 38.67 |
| (#9, #13, #19) | 47.00 | (#9, #13, #20) | 39.00 | (#9, #14, #15) | 48.33 | (#9, #14, #16) | 42.33 |
| (#9, #14, #17) | 40.33 | (#9, #14, #18) | 40.33 | (#9, #14, #19) | 48.67 | (#9, #14, #20) | 40.67 |
| (#9, #15, #16) | 48.33 | (#9, #15, #17) | 46.33 | (#9, #15, #18) | 46.33 | (#9, #15, #19) | 54.67 |
| (#9, #15, #20) | 46.67 | (#9, #16, #17) | 40.33 | (#9, #16, #18) | 40.33 | (#9, #16, #19) | 48.67 |
| (#9, #16, #20) | 40.67 | (#9, #17, #18) | 38.33 | (#9, #17, #19) | 46.67 | (#9, #17, #20) | 38.67 |
| (#9, #18, #19) | 46.67 | (#9, #18, #20) | 38.67 | (#9, #19, #20) | 47.00 | (#10, #11, #12) | 43.67 |
| (#10, #11, #13) | 40.33 | (#10, #11, #14) | 42.00 | (#10, #11, #15) | 48.00 | (#10, #11, #16) | 42.00 |
| (#10, #11, #17) | 40.00 | (#10, #11, #18) | 40.00 | (#10, #11, #19) | 48.33 | (#10, #11, #20) | 40.33 |
| (#10, #12, #13) | 47.33 | (#10, #12, #14) | 49.00 | (#10, #12, #15) | 55.00 | (#10, #12, #16) | 49.00 |
| (#10, #12, #17) | 47.00 | (#10, #12, #18) | 47.00 | (#10, #12, #19) | 55.33 | (#10, #12, #20) | 47.33 |
| (#10, #13, #14) | 45.67 | (#10, #13, #15) | 51.67 | (#10, #13, #16) | 45.67 | (#10, #13, #17) | 43.67 |
| (#10, #13, #18) | 43.67 | (#10, #13, #19) | 52.00 | (#10, #13, #20) | 44.00 | (#10, #14, #15) | 53.33 |
| (#10, #14, #16) | 47.33 | (#10, #14, #17) | 45.33 | (#10, #14, #18) | 45.33 | (#10, #14, #19) | 53.67 |
| (#10, #14, #20) | 45.67 | (#10, #15, #16) | 53.33 | (#10, #15, #17) | 51.33 | (#10, #15, #18) | 51.33 |
| (#10, #15, #19) | 59.67 | (#10, #15, #20) | 51.67 | (#10, #16, #17) | 45.33 | (#10, #16, #18) | 45.33 |
| (#10, #16, #19) | 53.67 | (#10, #16, #20) | 45.67 | (#10, #17, #18) | 43.33 | (#10, #17, #19) | 51.67 |
| (#10, #17, #20) | 43.67 | (#10, #18, #19) | 51.67 | (#10, #18, #20) | 43.67 | (#10, #19, #20) | 52.00 |
| (#11, #12, #13) | 36.67 | (#11, #12, #14) | 38.33 | (#11, #12, #15) | 44.33 | (#11, #12, #16) | 38.33 |
| (#11, #12, #17) | 36.33 | (#11, #12, #18) | 36.33 | (#11, #12, #19) | 44.67 | (#11, #12, #20) | 36.67 |
| (#11, #13, #14) | 35.00 | (#11, #13, #15) | 41.00 | (#11, #13, #16) | 35.00 | (#11, #13, #17) | 33.00 |
| (#11, #13, #18) | 33.00 | (#11, #13, #19) | 41.33 | (#11, #13, #20) | 33.33 | (#11, #14, #15) | 42.67 |
| (#11, #14, #16) | 36.67 | (#11, #14, #17) | 34.67 | (#11, #14, #18) | 34.67 | (#11, #14, #19) | 43.00 |
| (#11, #14, #20) | 35.00 | (#11, #15, #16) | 42.67 | (#11, #15, #17) | 40.67 | (#11, #15, #18) | 40.67 |
| (#11, #15, #19) | 49.00 | (#11, #15, #20) | 41.00 | (#11, #16, #17) | 34.67 | (#11, #16, #18) | 34.67 |
| (#11, #16, #19) | 43.00 | (#11, #16, #20) | 35.00 | (#11, #17, #18) | 32.67 | (#11, #17, #19) | 41.00 |
| (#11, #17, #20) | 33.00 | (#11, #18, #19) | 41.00 | (#11, #18, #20) | 33.00 | (#11, #19, #20) | 41.33 |
| (#12, #13, #14) | 42.00 | (#12, #13, #15) | 48.00 | (#12, #13, #16) | 42.00 | (#12, #13, #17) | 40.00 |
| (#12, #13, #18) | 40.00 | (#12, #13, #19) | 48.33 | (#12, #13, #20) | 40.33 | (#12, #14, #15) | 49.67 |
| (#12, #14, #16) | 43.67 | (#12, #14, #17) | 41.67 | (#12, #14, #18) | 41.67 | (#12, #14, #19) | 50.00 |
| (#12, #14, #20) | 42.00 | (#12, #15, #16) | 49.67 | (#12, #15, #17) | 47.67 | (#12, #15, #18) | 47.67 |
| (#12, #15, #19) | 56.00 | (#12, #15, #20) | 48.00 | (#12, #16, #17) | 41.67 | (#12, #16, #18) | 41.67 |
| (#12, #16, #19) | 50.00 | (#12, #16, #20) | 42.00 | (#12, #17, #18) | 39.67 | (#12, #17, #19) | 48.00 |
| (#12, #17, #20) | 40.00 | (#12, #18, #19) | 48.00 | (#12, #18, #20) | 40.00 | (#12, #19, #20) | 48.33 |
| (#13, #14, #15) | 46.33 | (#13, #14, #16) | 40.33 | (#13, #14, #17) | 38.33 | (#13, #14, #18) | 38.33 |
| (#13, #14, #19) | 46.67 | (#13, #14, #20) | 38.67 | (#13, #15, #16) | 46.33 | (#13, #15, #17) | 44.33 |
| (#13, #15, #18) | 44.33 | (#13, #15, #19) | 52.67 | (#13, #15, #20) | 44.67 | (#13, #16, #17) | 38.33 |
| (#13, #16, #18) | 38.33 | (#13, #16, #19) | 46.67 | (#13, #16, #20) | 38.67 | (#13, #17, #18) | 36.33 |
| (#13, #17, #19) | 44.67 | (#13, #17, #20) | 36.67 | (#13, #18, #19) | 44.67 | (#13, #18, #20) | 36.67 |
| (#13, #19, #20) | 45.00 | (#14, #15, #16) | 48.00 | (#14, #15, #17) | 46.00 | (#14, #15, #18) | 46.00 |
| (#14, #15, #19) | 54.33 | (#14, #15, #20) | 46.33 | (#14, #16, #17) | 40.00 | (#14, #16, #18) | 40.00 |
| (#14, #16, #19) | 48.33 | (#14, #16, #20) | 40.33 | (#14, #17, #18) | 38.00 | (#14, #17, #19) | 46.33 |
| (#14, #17, #20) | 38.33 | (#14, #18, #19) | 46.33 | (#14, #18, #20) | 38.33 | (#14, #19, #20) | 46.67 |
| (#15, #16, #17) | 46.00 | (#15, #16, #18) | 46.00 | (#15, #16, #19) | 54.33 | (#15, #16, #20) | 46.33 |
| (#15, #17, #18) | 44.00 | (#15, #17, #19) | 52.33 | (#15, #17, #20) | 44.33 | (#15, #18, #19) | 52.33 |
| (#15, #18, #20) | 44.33 | (#15, #19, #20) | 52.67 | (#16, #17, #18) | 38.00 | (#16, #17, #19) | 46.33 |
| (#16, #17, #20) | 38.33 | (#16, #18, #19) | 46.33 | (#16, #18, #20) | 38.33 | (#16, #19, #20) | 46.67 |
| (#17, #18, #19) | 44.33 | (#17, #18, #20) | 36.33 | (#17, #19, #20) | 44.67 | (#18, #19, #20) | 44.67 |
{
const slider = document.getElementById("margin-slider");
const marginVal = document.getElementById("margin-val-display");
const coverageDisplay = document.getElementById("coverage-display");
const mu = 43.45;
function updateTable() {
const table = document.getElementById("all-samples-fish");
if (!table || !slider || !marginVal || !coverageDisplay) return;
const M = parseFloat(slider.value);
marginVal.textContent = M.toFixed(1) + " dkg";
// Update headers from "Sample Mean (dkg)" to "CI"
const headers = table.querySelectorAll("thead th");
headers.forEach((th, index) => {
if (index % 2 === 1 && th.textContent !== "CI") {
th.textContent = "CI";
}
});
// Update caption dynamically to remind students of the true mean
const caption = table.querySelector("caption");
if (caption && !caption.dataset.updated) {
caption.dataset.updated = "true";
caption.innerHTML = "<strong>Table 2:</strong> <em>All possible samples of three fish from the aquarium and their respective confidence intervals. (Reminder: true mean is μ = 43.45 dkg).</em>";
}
const cells = table.querySelectorAll("tbody td");
let totalCount = 0;
let coverCount = 0;
for (let i = 0; i < cells.length; i += 2) {
if (i + 1 >= cells.length) break;
const labelCell = cells[i];
const valCell = cells[i+1];
// Store original mean value if not already done
if (!valCell.dataset.originalMean) {
valCell.dataset.originalMean = valCell.textContent.trim();
}
const originalMeanStr = valCell.dataset.originalMean;
const meanVal = parseFloat(originalMeanStr);
if (!isNaN(meanVal)) {
totalCount++;
const covers = Math.abs(meanVal - mu) <= M;
// Update the cell content to show "mean ± M"
valCell.textContent = `${originalMeanStr} ± ${M.toFixed(1)}`;
if (covers) {
coverCount++;
labelCell.style.backgroundColor = "#e8f5e9"; // light green background
labelCell.style.color = "#2e7d32"; // dark green text
valCell.style.backgroundColor = "#e8f5e9";
valCell.style.color = "#2e7d32";
} else {
labelCell.style.backgroundColor = "#ffebee"; // light red background
labelCell.style.color = "#c62828"; // dark red text
valCell.style.backgroundColor = "#ffebee";
valCell.style.color = "#c62828";
}
}
}
const percentage = (coverCount / totalCount) * 100;
coverageDisplay.textContent = `Coverage: ${percentage.toFixed(1)}% (${coverCount} / ${totalCount} CIs)`;
}
if (slider) {
slider.addEventListener("input", updateTable);
// Run update multiple times on load/reveal events to ensure correct rendering in Revealjs slides
updateTable();
setTimeout(updateTable, 100);
setTimeout(updateTable, 500);
// Also update whenever Reveal.js slide changes (to handle lazy rendering)
if (window.Reveal) {
window.Reveal.on('slidechanged', updateTable);
}
}
}
Guesses this match: 0
5.0 dkg
Coverage: –
{
// Quarto/Reveal.js can re-run this OJS cell when the slide is revisited
// (the coverage-table cell has the same issue, but is idempotent so it
// doesn't matter there). Here each run would create a fresh closure with
// its own hidden population and re-register click listeners on top of the
// old ones, so the same "seed" could silently produce different games.
// Guard so the whole setup only ever runs once per container.
const gameContainer = document.getElementById("game-container");
if (gameContainer && gameContainer.dataset.gameInitialized) {
// Already initialized in an earlier run of this cell -- do nothing.
} else {
if (gameContainer) gameContainer.dataset.gameInitialized = "true";
const seedInput = document.getElementById("game-seed-input");
const newGameBtn = document.getElementById("new-game-btn");
const guessCounterEl = document.getElementById("game-guess-counter");
const slider = document.getElementById("game-margin-slider");
const marginVal = document.getElementById("game-margin-val");
const coverageDisplay = document.getElementById("game-coverage-display");
const drawBtn = document.getElementById("draw-btn");
const playzone = document.getElementById("game-playzone");
const fishDisplay = document.getElementById("fish-display");
const questionEl = document.getElementById("game-question");
const guessYesBtn = document.getElementById("guess-yes");
const guessNoBtn = document.getElementById("guess-no");
const feedbackEl = document.getElementById("game-feedback");
const scoreCorrectEl = document.getElementById("score-correct");
const scoreTotalEl = document.getElementById("score-total");
const streakEl = document.getElementById("score-streak");
const revealBtn = document.getElementById("reveal-mean-btn");
const trueMeanDisplay = document.getElementById("true-mean-display");
// Number of guesses in the current match before the reveal button appears.
const REVEAL_AFTER_GUESSES = 3;
// Overall score, kept across matches (only reset on page load).
let totalGuesses = 0;
let correctGuesses = 0;
let streak = 0;
// Per-match state (reset every time a new hidden population is generated).
let weights = [];
let mu = 0;
let allMeans = [];
let matchGuessCount = 0;
let currentIndices = null;
let currentMean = 0;
// Seeded PRNG (mulberry32) so a given seed always reproduces the same population.
function mulberry32(seed) {
let a = seed;
return function () {
a |= 0; a = (a + 0x6D2B79F5) | 0;
let t = Math.imul(a ^ (a >>> 15), 1 | a);
t = (t + Math.imul(t ^ (t >>> 7), 61 | t)) ^ t;
return ((t ^ (t >>> 14)) >>> 0) / 4294967296;
};
}
// Turns whatever the student typed (a number or arbitrary text) into a 32-bit integer seed.
function seedFromInput(str) {
if (!str) return Math.floor(Math.random() * 1e9);
const trimmed = str.trim();
if (/^\d+$/.test(trimmed)) return parseInt(trimmed, 10) >>> 0;
let h = 0;
for (let i = 0; i < trimmed.length; i++) {
h = (Math.imul(31, h) + trimmed.charCodeAt(i)) | 0;
}
return h >>> 0;
}
function randNormal(rng, mean, sd) {
const u1 = rng();
const u2 = rng();
const z = Math.sqrt(-2 * Math.log(u1)) * Math.cos(2 * Math.PI * u2);
return mean + z * sd;
}
// Generates a hidden population of 20 "fish" from a seed. The true mean is
// never derived from a fixed constant -- it is whatever the generated
// population's mean turns out to be, so it is genuinely unknown up front.
function generatePopulation(seed) {
const rng = mulberry32(seed);
const baseMean = 30 + rng() * 30; // somewhere between 30 and 60 dkg
const pop = [];
for (let i = 0; i < 20; i++) {
const w = Math.max(5, randNormal(rng, baseMean, 8));
pop.push(Math.round(w * 10) / 10);
}
const trueMean = pop.reduce((a, b) => a + b, 0) / pop.length;
return { weights: pop, mu: trueMean };
}
function computeAllMeans(pop) {
const means = [];
for (let i = 0; i < 20; i++) {
for (let j = i + 1; j < 20; j++) {
for (let k = j + 1; k < 20; k++) {
means.push((pop[i] + pop[j] + pop[k]) / 3);
}
}
}
return means;
}
function getCoverage(M) {
let coverCount = 0;
allMeans.forEach(meanVal => {
if (Math.abs(meanVal - mu) <= M) {
coverCount++;
}
});
const pct = ((coverCount / allMeans.length) * 100).toFixed(1);
return { pct, count: coverCount, total: allMeans.length };
}
function updateSliderDisplay() {
if (!slider || !marginVal || !coverageDisplay) return;
const M = parseFloat(slider.value);
marginVal.textContent = M.toFixed(1) + " dkg";
const cov = getCoverage(M);
coverageDisplay.textContent = `Coverage: ${cov.pct}% (${cov.count} / ${cov.total} CIs)`;
// Update the question text dynamically if a sample is active and we haven't guessed yet
if (currentIndices && feedbackEl && feedbackEl.style.display === "none") {
updateQuestionPrompt(M);
}
}
function updateQuestionPrompt(M) {
questionEl.innerHTML = `Does this sample yield a confidence interval <em>x̄</em> ± <em>M</em> ` +
`(i.e., <span style="font-size: 1.1em; color: #1a237e; background: #e8eaf6; padding: 0.15em 0.4em; border-radius: 4px; font-weight: 800; font-family: monospace;">` +
`${currentMean.toFixed(2)} ± ${M.toFixed(1)}</span>) that captures the true parameter?`;
}
// Starts a fresh match: regenerates the hidden population/mean from the
// seed box (writing back a random seed if the box was left blank so it
// can be copied down to replay this exact match later).
function startNewMatch() {
const seed = seedFromInput(seedInput.value);
seedInput.value = String(seed);
const generated = generatePopulation(seed);
weights = generated.weights;
mu = generated.mu;
allMeans = computeAllMeans(weights);
matchGuessCount = 0;
currentIndices = null;
currentMean = 0;
guessCounterEl.textContent = `Guesses this match: ${matchGuessCount}`;
revealBtn.style.display = "none";
trueMeanDisplay.textContent = "";
playzone.style.display = "none";
feedbackEl.style.display = "none";
updateSliderDisplay();
}
function handleDraw() {
// Select 3 random unique indices
let indices = [];
while (indices.length < 3) {
const idx = Math.floor(Math.random() * 20);
if (!indices.includes(idx)) {
indices.push(idx);
}
}
currentIndices = indices;
const sampleWeights = indices.map(i => weights[i]);
const sum = sampleWeights.reduce((a, b) => a + b, 0);
currentMean = sum / 3;
// Display fish visuals scaled by weight
fishDisplay.innerHTML = "";
indices.forEach(idx => {
const wt = weights[idx];
const fishNum = (idx % 4) + 1;
const height = 20 + ((wt - 24) / (61 - 24)) * 20; // scale between 20px and 40px
const wrapper = document.createElement("div");
wrapper.style.display = "flex";
wrapper.style.flexDirection = "column";
wrapper.style.alignItems = "center";
wrapper.style.gap = "0.2em";
const img = document.createElement("img");
img.src = `../slides-module01/imgs/fish${fishNum}.svg`;
img.style.height = `${height}px`;
img.style.width = "auto";
img.style.filter = "drop-shadow(0px 2px 4px rgba(0,0,0,0.15))";
const label = document.createElement("span");
label.textContent = `Fish #${idx+1}`;
label.style.fontSize = "0.75em";
label.style.fontWeight = "bold";
label.style.color = "#37474f";
wrapper.appendChild(img);
wrapper.appendChild(label);
fishDisplay.appendChild(wrapper);
});
// Update text and show gameplay zone
const M = parseFloat(slider.value);
updateQuestionPrompt(M);
playzone.style.display = "block";
feedbackEl.style.display = "none";
document.getElementById("guess-buttons").style.display = "flex";
// Scroll slider slide to keep the game in view
playzone.scrollIntoView({ behavior: 'smooth', block: 'nearest' });
}
function handleGuess(guessYes) {
if (!currentIndices) return;
const M = parseFloat(slider.value);
const lower = currentMean - M;
const upper = currentMean + M;
const covers = (mu >= lower) && (mu <= upper);
const isCorrect = (guessYes && covers) || (!guessYes && !covers);
totalGuesses++;
matchGuessCount++;
guessCounterEl.textContent = `Guesses this match: ${matchGuessCount}`;
if (isCorrect) {
correctGuesses++;
streak++;
feedbackEl.style.backgroundColor = "#e8f5e9";
feedbackEl.style.color = "#2e7d32";
feedbackEl.innerHTML = "Correct!";
} else {
streak = 0;
feedbackEl.style.backgroundColor = "#ffebee";
feedbackEl.style.color = "#c62828";
feedbackEl.innerHTML = "Not quite.";
}
// Update scoreboard
scoreCorrectEl.textContent = correctGuesses;
scoreTotalEl.textContent = totalGuesses;
streakEl.textContent = `${streak} ${streak > 0 ? "🔥" : ""}`;
// Hide buttons and show feedback
document.getElementById("guess-buttons").style.display = "none";
feedbackEl.style.display = "block";
// Clear sample state
currentIndices = null;
// Only offer the reveal after enough guesses in this match, so students
// cannot just draw once and immediately check the answer.
if (matchGuessCount >= REVEAL_AFTER_GUESSES) {
revealBtn.style.display = "inline-block";
}
}
function handleReveal() {
trueMeanDisplay.textContent = `True mean for this seed: ${mu.toFixed(2)} dkg`;
}
if (newGameBtn) {
newGameBtn.addEventListener("click", startNewMatch);
}
if (slider) {
slider.addEventListener("input", updateSliderDisplay);
}
if (drawBtn) {
drawBtn.addEventListener("click", handleDraw);
}
if (guessYesBtn) {
guessYesBtn.addEventListener("click", () => handleGuess(true));
}
if (guessNoBtn) {
guessNoBtn.addEventListener("click", () => handleGuess(false));
}
if (revealBtn) {
revealBtn.addEventListener("click", handleReveal);
}
startNewMatch();
}
}We want to find intervals that are narrow and have high coverage.
How can we find those intervals when we only have one sample?
We can use our estimated sampling distribution:




We can report both our sample point estimate and the confidence interval.
Point estimate: Our best estimate of the population parameter.
Confidence interval: A plausible range of values where we expect the true population parameter to fall.
The infer package builds the bootstrap distribution with a pipeline of four verbs:
specify(): which variable are we studying?generate(): resample (with replacement) 1000 timescalculate(): compute the statistic for each resamplebootstrap_dist is a tibble with one row per resample:
Response: var (numeric)
# A tibble: 1,000 × 2
replicate stat
<int> <dbl>
1 1 14.9
2 2 14.8
3 3 15.2
4 4 15.7
5 5 16.2
6 6 13.6
7 7 14.8
8 8 14.5
9 9 13.8
10 10 15.8
# ℹ 990 more rows
level: the confidence level (e.g. \(0.95\) for a \(95\%\) CI)type = "percentile": use the percentile method we just learned# A tibble: 1 × 2
lower_ci upper_ci
<dbl> <dbl>
1 12.3 16.8
The specify() |> generate() |> calculate() pipeline does not change – only what we specify and calculate does.
Try editing and running the code on the next slides yourself!
A delivery app wants to know the average delivery time for orders placed downtown.
A shipping company wants to know what fraction of packages in a shipment arrive damaged.
Note
For a categorical variable, specify() needs success to say which level we are counting.
A reviewer wants to know if two phone models really differ in average battery life.
Note
Comparing two groups uses a formula, response ~ explanatory, and order fixes the direction of the subtraction.
A company wants to know if a website redesign really improved the conversion rate.
Scroll down
A confidence interval (CI) gives a plausible range where we expect our true population parameter to fall.
We can calculate the \(C\%\) CI by taking the \(\bigl(\frac{100-C}{2} \bigr)^{\text{th}}\) and \(\bigl( \frac{100+C}{2} \bigr)^{\text{th}}\) percentiles from the bootstrap distribution.
Interpretation: We are \(C\%\) confident that the true population parameter lies within our interval.
Confidence vs. precision trade-off: A higher level of confidence yields a wider (less precise) interval.
worksheet_04We are here to help!
© 2024 Rodolfo Lourenzutti, Melissa Lee, Marie Auger-Méthé – Material Licensed under CC By-SA 4.0