A potential erratum from Chapter 2?
Closed this issue · 3 comments
This is outside the scope of this repository (i.e. the error, I believe, is in the book itself), but it looks like the normalization for the grid approximation might be done incorrectly?
It doesn't seem to take into account the number of points in the grid / the thickness of each approximated section, so the normalization isn't actually normalizing the integral to be 1, just the raw probabilities?
This means changing the number of points changes the scale y-axis of the approximation significantly!
Plotting it over the analytical solution, we have, uncorrected (i.e. as written in the book):
But with the * (1/size)
correction applied in the normalization step:
The height is still a little off there, since that Riemann sum isn't perfect, but it approaches a perfect approximation with infinite points — either way, I believe this is the correct way to normalize a grid approximation? At least one random person on the internet seems to agree: https://stats.stackexchange.com/a/609243
For the actually actionable part of this issue: if this is a mistake, should be correct it in these notebooks and leave a short note mentioning that it might be slightly wrong in the book?
Let me know what you think!
I remember I struggled with that as well. Dividing by N (or size) seems the bring the y-scale in line with the Beta approximation.
Indeed, adding a note like below would be great:
md"
!!! note
_your text here_."
Thanks again. Will you make a PR? I have no problem adding you to the Github team so you can merge PRs. Up to you!
Rob
Hi @goedman !
Happy to make a PR and happy to be added to the Github team! I've been working though the book during my mornings, so it may take a day or two, but I'll have something ready soon!
Thanks a ton,
Brooks
Just send you an invite for StatisticalRethinkingJulia.
Definitely great to have someone really working through the notebooks once more!
The first 4 chapters are quite similar for Turing and Stan. It’ll be a bit different for chapters 5 & 6 (DAG stuff) and 7 & 8 (entropy, waic and psis stuff). For both these sets of chapters I initially wrote “placeholder” packages, but for Stan I’m switching respectively to CausalInference.jl and PSIS.jl (from Arviz).