Skip to content

13.3: add an example on the number of bootstrap repetitions - #268

Open
prawalpokharel wants to merge 1 commit into
data-8:mainfrom
prawalpokharel:13.3-bootstrap-repetitions
Open

prawalpokharel wants to merge 1 commit into
data-8:mainfrom
prawalpokharel:13.3-bootstrap-repetitions

Conversation

@prawalpokharel

Copy link
Copy Markdown

Section 13.3 recommends thousands of bootstrap repetitions, and the 80% interval discussion says a narrower interval needs a larger sample. This adds a short subsection after "Care in Using the Bootstrap Percentile Method" that puts the two numbers side by side.

It builds the 95% interval for the proportion of smokers in births ten times each with 100, 1,000 and 10,000 repetitions. Two small group tables then show how far apart the ends are and the average width. With more repetitions the ends agree more closely, and the average width stays between 0.05 and 0.06.

The code uses the chapter's tools (make_array, np.append in a loop, percentile, group). It resamples only the Maternal Smoker column with np.random.choice, since 111,000 calls to births.sample() would take about 5 minutes. The new cell takes about 5 seconds.

The book is not seeded, so the text quotes no single run. I checked each sentence that depends on the random draws against 1,000 seeded reruns of the new cells, and each held in at least 99% of them. The notebook runs from a fresh kernel without errors, existing cells and outputs are unchanged, and the new cells have outputs from that run. A build with jupyter-book 2.1.7 on Node 22 changes only the 13.3 page.

The accessibility check has been failing on recent runs because of the footer links (#264), so it may fail here too.

Separately, since book-theme 2.0.0 (Nov 10), jupyter-book build --html fails on Node 18 with node: bad option: --env-file=./.env.prod. The deploy workflow uses Node 18, so the next deploy will probably fail. #267 moves it to Node 22, and it would be worth merging that first.

Happy to shorten this, move it, or drop the second table.

Add a short subsection after "Care in Using the Bootstrap Percentile
Method". It builds the 95% interval for the proportion of smokers ten
times each with 100, 1,000 and 10,000 repetitions, then compares how
far apart the ends are and how wide the intervals are. The text ties
the width to the 1,174 mothers in the sample.

Existing cells and outputs are unchanged. The new code cells have
outputs from a fresh run of the notebook.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant