Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chapter 7 of Statistical Rethinking 2nd Edition #86

Merged
merged 10 commits into from
May 21, 2020

Conversation

oscarbranson
Copy link
Contributor

@oscarbranson oscarbranson commented May 4, 2020

As promised (#67) here's a first stab at Chp_07. It turned out to be a bit more of a beast than I expected, and there are a few things that aren't quite right - any corrections/pointers appreciated. You said you might be able to help, @aloctavodia?

I've stolen quite a few bits from Chapter 6 of the 1st Edition (these are cited).

There are a few comments throughout where I hit trouble, but the main ones are:

  • Code 7.3-7.10 I've use MCMC here, Chapter 6 of the 1st Edition used OLS. As a result the credible intervals on Figure 7.3 are much larger here than in the book, and following LPPD estimates are quite different from numbers in the book (in absolute, not relative magnitude).
  • Code 7.18 The uncertainties here are much larger than in the book (they also were in 1st Ed). I assume this is a MCMC vs. OLS problem again?
  • Code 7.27-7.30 Can't work out how to reproduce the book results using the arviz.waic function. Mainly because I'm not sure how outputs of arviz.waic and rethinking's WAIC function are different. Neither documentation is particularly informative about what the functions actually calculate. A barrier in arviz.waic is that setting pointwise=True doesn't seem to return a pointwise result (returns identical if set to False) as it does in WAIC, which makes a lot of the book examples impossible. Could probably work out how to do it manually, but feels like I shouldn't have to! What have I missed?!
  • Code 7.31 My solution here is ugly. Couldn't find an obvious way to calculate pairwise dSE using arviz as a single number.
  • Code 7.43 Is also blocked by my confusion over the behaviour of setting pairwise=True in arviz.waic.

@review-notebook-app
Copy link

Check out this pull request on  ReviewNB

Review Jupyter notebook visual diffs & provide feedback on notebooks.


Powered by ReviewNB

Rethinking_2/Chp_07.ipynb Show resolved Hide resolved
Rethinking_2/Chp_07.ipynb Show resolved Hide resolved
Rethinking_2/Chp_07.ipynb Show resolved Hide resolved
Rethinking_2/Chp_07.ipynb Show resolved Hide resolved
Rethinking_2/Chp_07.ipynb Show resolved Hide resolved
Rethinking_2/Chp_07.ipynb Show resolved Hide resolved
@oscarbranson
Copy link
Contributor Author

Thanks for the comments @aloctavodia. I've dealt with most of them, as well as re-done the back end of the notebook... it seems I was working from a book draft, and the final version contained quite different examples!

Just awaiting clarification on your the dataset_dict in your suggestion above, then I'll get it into merge-able state.

@oscarbranson
Copy link
Contributor Author

OK @aloctavodia, I think I've taken care of your suggestions. Apart from the several issues that you'll probably find that need correcting, I think this is ready to merge 😄

@aloctavodia
Copy link
Member

LGTM, I will add a semicolon at the end of the last line of matplotlib functions to avoid the ouputs. Regarding the computation of the pairwise dse. I think we can revisit it after we decide what to do in ArviZ.

@oscarbranson
Copy link
Contributor Author

Ah! Keep forgetting about that. Just fixed it, @aloctavodia.

@aloctavodia aloctavodia merged commit fd861e9 into pymc-devs:master May 21, 2020
aloctavodia added a commit that referenced this pull request May 21, 2020
* Added Chapter 6

* First attempt at Chp_07

* Data for Chp_07

* removed chapter 6 from 7 branch

* Refresh and Run All in botebook

* Progress towards #86. All but pairwise WAIC calculation done. Awaiting clarification from @aloctavodia.

* hacky solution to pairwise dse comparison

* run black_nbconvert

* clean start

* First draft of Chp_08

* ran through black_nbconvert

* restart and run all

* Data for Chp_08

* remove unneeded data

* Addressed @aloctovadia's comments (except standardised)
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.

3 participants