Closed NathanielF closed 1 year ago
Check out this pull request on
See visual diffs & provide feedback on Jupyter Notebooks.
Powered by ReviewNB
I think this is close to done now. Tagging @aloctavodia and @drbenvincent since you both expressed an interest in the topic. The broad structure of the notebook is as follows:
I focus on 2 examples of iterative model building and the extraction of the within-individual and across-individual trajectories of growth learned by the model. I've tried to explain the crucial aspects of the model as i understand them without getting too caught up in the confusing vocabulary of fixed and random effects, so i'd be grateful for feedback on this aspect especially. I don't want to add to the confusion around these terms!
In the first example i follow the textbook very closely using a normal likelihood and derive parameter estimates akin to those reported in the text. In the second example i go off-reservation and use a gumbel likelihood with censoring which looks more appropriate to me than the Normal likelihood they were constrained to use in the text. I also briefly call out that you can (and probably should) use Bambi for these kinds of models where possible.
Sorry for slow response @NathanielF. Fingers crossed I'll have time to review this weekend, or early next week.
Sorry for slow response @NathanielF. Fingers crossed I'll have time to review this weekend, or early next week.
No problem! Thanks for letting me know.
Giving this one another nudge in case Friday is a good day for this review @drbenvincent?
View / edit / reply to this conversation on ReviewNB
drbenvincent commented on 2023-03-11T17:27:55Z ----------------------------------------------------------------
First line should have the name of the notebook in the parentheses, not the _title_ of the notebook
NathanielF commented on 2023-03-12T13:54:09Z ----------------------------------------------------------------
Amended
View / edit / reply to this conversation on ReviewNB
drbenvincent commented on 2023-03-11T17:27:56Z ----------------------------------------------------------------
Double check the pymc.sampling_jax import line, just include what's necessary. Optionally, if you use PyMC 5.1.0, you can avoid importing these I believe and provide a nuts_sampler
argument to pm.sample
.
NathanielF commented on 2023-03-12T13:57:42Z ----------------------------------------------------------------
Yeah, i don't need the blackjax sampler. Removed now.
View / edit / reply to this conversation on ReviewNB
drbenvincent commented on 2023-03-11T17:27:57Z ----------------------------------------------------------------
Capitalize Bayesian
Structure makes it sound like Bambi is used exclusively, but it's only used for one model?
NathanielF commented on 2023-03-12T13:59:12Z ----------------------------------------------------------------
Adjusted this now to be more explicit that the bambi section is a digression to explain an alternative method. Capitalised Bayesian too
View / edit / reply to this conversation on ReviewNB
drbenvincent commented on 2023-03-11T17:27:58Z ----------------------------------------------------------------
Ad space after try/except block
NathanielF commented on 2023-03-12T13:59:39Z ----------------------------------------------------------------
Adjusted.
View / edit / reply to this conversation on ReviewNB
drbenvincent commented on 2023-03-11T17:27:59Z ----------------------------------------------------------------
Use the hide-input
cell tag. See style guide for more info.
NathanielF commented on 2023-03-12T13:59:52Z ----------------------------------------------------------------
Hidden
View / edit / reply to this conversation on ReviewNB
drbenvincent commented on 2023-03-11T17:28:00Z ----------------------------------------------------------------
Use the hide-input
cell tag. See style guide for more info.
NathanielF commented on 2023-03-12T14:02:43Z ----------------------------------------------------------------
hidden
View / edit / reply to this conversation on ReviewNB
drbenvincent commented on 2023-03-11T17:28:01Z ----------------------------------------------------------------
Use the hide-input
cell tag. See style guide for more info.
NathanielF commented on 2023-03-12T14:02:57Z ----------------------------------------------------------------
hidden
View / edit / reply to this conversation on ReviewNB
drbenvincent commented on 2023-03-11T17:28:02Z ----------------------------------------------------------------
Coloured equations are great!
For the equation block, can you put that in a latex aligned equation block, like this?
$$ \begin{aligned} \alpha & = something \\ z_{b,t} &= something else \\ \end{aligned} $$
NathanielF commented on 2023-03-12T14:04:35Z ----------------------------------------------------------------
adjusted. Note one concern here is the color formatting renders differently to color the whole line rather than just the symbols on the site.
View / edit / reply to this conversation on ReviewNB
drbenvincent commented on 2023-03-11T17:28:03Z ----------------------------------------------------------------
Use the hide-input
cell tag. See style guide for more info.
NathanielF commented on 2023-03-12T14:04:49Z ----------------------------------------------------------------
Hidden
View / edit / reply to this conversation on ReviewNB
drbenvincent commented on 2023-03-11T17:28:04Z ----------------------------------------------------------------
Maybe stick with regular colour palette and use C0
rather than magenta?
NathanielF commented on 2023-03-12T15:23:39Z ----------------------------------------------------------------
Done.
View / edit / reply to this conversation on ReviewNB
drbenvincent commented on 2023-03-11T17:28:05Z ----------------------------------------------------------------
Maybe use colour C0
rather than cyan?
NathanielF commented on 2023-03-12T14:05:05Z ----------------------------------------------------------------
Adjusted
View / edit / reply to this conversation on ReviewNB
drbenvincent commented on 2023-03-11T17:28:06Z ----------------------------------------------------------------
Use the hide-input
cell tag. See style guide for more info.
View / edit / reply to this conversation on ReviewNB
drbenvincent commented on 2023-03-11T17:28:07Z ----------------------------------------------------------------
Use the hide-input
cell tag. See style guide for more info.
NathanielF commented on 2023-03-12T14:05:20Z ----------------------------------------------------------------
hidden
View / edit / reply to this conversation on ReviewNB
drbenvincent commented on 2023-03-11T17:28:08Z ----------------------------------------------------------------
Use the hide-input
cell tag. See style guide for more info.
I'd also recommend to include the custom plot function in this hidden code cell
NathanielF commented on 2023-03-12T14:05:46Z ----------------------------------------------------------------
hidden
View / edit / reply to this conversation on ReviewNB
drbenvincent commented on 2023-03-11T17:28:09Z ----------------------------------------------------------------
Watermark needs a markdown header, see style guide.
NathanielF commented on 2023-03-12T14:06:18Z ----------------------------------------------------------------
adjusted
View / edit / reply to this conversation on ReviewNB
drbenvincent commented on 2023-03-11T17:28:10Z ----------------------------------------------------------------
Final cell in notebooks needs to be this. See style guide for more info
:::{include} ../page_footer.md
:::
NathanielF commented on 2023-03-12T14:06:00Z ----------------------------------------------------------------
Adjusted
Adjusted this now to be more explicit that the bambi section is a digression to explain an alternative method. Capitalised Bayesian too
View entire conversation on ReviewNB
adjusted. Note one concern here is the color formatting renders differently to color the whole line rather than just the symbols on the site.
View entire conversation on ReviewNB
Nice. I'll endeavour to do a final pass, reviewing content/clarity in the next few days and we can ship this :) Do feel free to ping me, but it is on my list.
Consider moving from the Case Studies section to the Time Series section of the repo
On this point, i think i prefer it in the case studies section. Time series analysis/modelling is (in my head anyway) a different kind of beast than longitudinal curve analysis. They're clearly, related... but just not the same bucket for me. Can move it if you feel strongly about it, but i prefer it as it is.
On the watermark thing i wasn't sure what you meant... it looks ok to me:
Nice. I'll endeavour to do a final pass, reviewing content/clarity in the next few days and we can ship this :) Do feel free to ping me, but it is on my list.
Perfect. Thanks for your help on this!
Just a small nudge @drbenvincent.
Typo in this sentence "Implementing the model is PyMC is as follows"
I'm wondering if we could get the model math for the "The Uncontrolled Effects of Parental Alcoholism" model. Don't worry about the colour coding if that gets messy.
Same for the "Model controlling for Peer Effects" model
After this sentence
The formula specification uses 1 to denote an intercept term and a conditional | operator to denote a subject level parameter combined with the global parameter of the same type in the manner specified above.
could you just spell out how to read the hierarchical term (1 + age_14 | id)
in the Bambi model equation
And we don't need the 0 +
part of the equation I believe?
I think there's one instance of a lower case "bambi", but everything else is capitalised.
This is great. Happy to approve after these minor tweaks 👍 Sorry for the delay in finishing the review
Thanks @drbenvincent! Will get to these tonight.
Made those changes @drbenvincent. Seemed to work in the Review Notebook, but docs build check renders strangely: Seems to effect all notebooks, so likely something to do with the broader site render than my specific PR here.
Probably related to this: https://github.com/pymc-devs/pymc-examples/issues/541
Happy with it. Feel free to merge! Thanks again
Example Notebook on Longitudinal Analysis and Growth Curve Trajectories.
Related to this issue: https://github.com/pymc-devs/pymc-examples/issues/508
Example of iterative model construction on longitudinal data following the Willett and Singer book. In the first model we follow the text quite closely, and in the second model we choose an alternative likelihood model and fully difrerent set of priors.