Open ikimmit opened 6 months ago
Good catch! Yes, resampling the same person was skewing the simulation results. The code in boston.py has been updated. Twenty runs produces 0.77425 +/- 0.00033 (mean +/- SE), inline with the calculated probability of 0.7745.
Hi! I'm loving the book, but found a logical error in one of the exercises, namely the Boston problem of Chapter 2.
This line will occasionaly sample the same person repeatedly:
A way to fix it is using this instead:
You then comment on the results:
But that value is actually a telltale of the underlying bug. I tried the fix and the values converge to 0.7745 as they should.
This is my full code for testing (using a more modern version of numpy with RNG):