vasishth / bayescogsci

Draft of book entitled An Introduction to Bayesian Data Analysis for Cognitive Science by Nicenboim, Schad, Vasishth
100 stars 27 forks source link

sec-hierstan.html #13

Closed themeo closed 2 years ago

themeo commented 3 years ago

It is not an error or anything, just a suggestion for improvement to make it more palatable to readers. There are lots of things happening here and the transition to non-centered parameterization could be perhaps made a little bit unpacked and explained step by step:

After box 11.1, it would be useful to specify the full re-parametrized model in the non-code notation again, just so the reader doesn't have to jump back many pages to see the last specification of the model presented in the context of centered parametrization.

Then, after the Stan code (hierarchical3.stan) it could be perhaps easier if the new functions -- std_normal_lpdf() and to_vector() -- would be properly introduced instead of just being mentioned in passing in the context of optimizing the code. They are only obvious after you already know them. ;) Also, there is a new section transformed parameters -- it could be explained when this section is executed, what is its purpose, etc. Something like: with each iteration of the sampler we start with new values of alpha, beta, sigma, z - then we call transformed parameters to obtain u, then we recompute the target as specified in the model section. It took me a while to realize how the machinery works with all the reparametrization.

Also, in hierarchical2.stan we now use matrix data type for u. I get it why, but perhaps a short comment about it would also help some ppl. And it is probably the first time in the book when .* operator is used -- would be also worth introducing it.

bnicenboim commented 2 years ago

done