pymc-devs / pymc-examples

Examples of PyMC models, including a library of Jupyter notebooks.
https://www.pymc.io/projects/examples/en/latest/
MIT License
280 stars 243 forks source link

Longitudinal models #520

Closed NathanielF closed 1 year ago

NathanielF commented 1 year ago

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.

review-notebook-app[bot] commented 1 year ago

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

NathanielF commented 1 year ago

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:

image

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.

drbenvincent commented 1 year ago

Sorry for slow response @NathanielF. Fingers crossed I'll have time to review this weekend, or early next week.

NathanielF commented 1 year ago

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.

NathanielF commented 1 year ago

Giving this one another nudge in case Friday is a good day for this review @drbenvincent?

review-notebook-app[bot] commented 1 year ago

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