-
-
Notifications
You must be signed in to change notification settings - Fork 258
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
CFA and SEM with PyMC #698
Conversation
Signed-off-by: Nathaniel <[email protected]>
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
Signed-off-by: Nathaniel <[email protected]>
Signed-off-by: Nathaniel <[email protected]>
Signed-off-by: Nathaniel <[email protected]>
Signed-off-by: Nathaniel <[email protected]>
Signed-off-by: Nathaniel <[email protected]>
Signed-off-by: Nathaniel <[email protected]>
Signed-off-by: Nathaniel <[email protected]>
Signed-off-by: Nathaniel <[email protected]>
Signed-off-by: Nathaniel <[email protected]>
Signed-off-by: Nathaniel <[email protected]>
Signed-off-by: Nathaniel <[email protected]>
Signed-off-by: Nathaniel <[email protected]>
Signed-off-by: Nathaniel <[email protected]>
Signed-off-by: Nathaniel <[email protected]>
Signed-off-by: Nathaniel <[email protected]>
Think this is ready for review @drbenvincent , @cluhmann , @AlexAndorra . Any feedback/pushback welcome. |
Giving this another nudge! Thanks! |
FYI: I'm totally overloaded at the moment, so going to struggle with a review. Will see if things ease up a bit next week. |
No worries. |
View / edit / reply to this conversation on ReviewNB fonnesbeck commented on 2024-09-25T03:08:46Z Perhaps add reference to psychometrics in the title to make it more specific, and aid in discoverability. NathanielF commented on 2024-09-25T11:38:08Z Good idea. |
View / edit / reply to this conversation on ReviewNB fonnesbeck commented on 2024-09-25T03:08:47Z nitpick: data set should not have a hyphen; data set or dataset, no? NathanielF commented on 2024-09-25T11:38:41Z changed. |
View / edit / reply to this conversation on ReviewNB fonnesbeck commented on 2024-09-25T03:08:47Z Maybe hyperlink SEM and CFA to some introductory materials on the topics (even a Wikipedia link would be good) NathanielF commented on 2024-09-25T11:38:54Z Added links to wikipedia. |
View / edit / reply to this conversation on ReviewNB fonnesbeck commented on 2024-09-25T03:08:48Z There are lots of UserWarnings in the notebook. Consider filtering them out. |
View / edit / reply to this conversation on ReviewNB fonnesbeck commented on 2024-09-25T03:08:49Z The last line of the equation set contains a typo -- should be \psi_n rather than \psi_3 NathanielF commented on 2024-09-25T11:39:29Z Fixed. Thanks, good catch! |
View / edit / reply to this conversation on ReviewNB fonnesbeck commented on 2024-09-25T03:08:50Z Line #29. chol, _, _ = pm.LKJCholeskyCov("chol_cov", n=2, eta=2, sd_dist=sd_dist, compute_corr=True) Why do you set NathanielF commented on 2024-09-25T11:40:37Z It's not used here in this model, but useful to have computed for analysing the correlations between the constructs post model fit. I demonstrate this below for the full measurement model.... |
View / edit / reply to this conversation on ReviewNB fonnesbeck commented on 2024-09-25T03:08:50Z Cool plots! NathanielF commented on 2024-09-25T11:45:43Z Thanks! |
View / edit / reply to this conversation on ReviewNB fonnesbeck commented on 2024-09-25T03:08:51Z Line #81. draws=10000, Why so many draws? Bad autocorrelation? NathanielF commented on 2024-09-25T11:42:40Z Yes, it seemed to help generally boost the ESS. The model samples pretty fast so it was easy enough to just boost the samples. |
View / edit / reply to this conversation on ReviewNB fonnesbeck commented on 2024-09-25T03:08:52Z typo: reflected NathanielF commented on 2024-09-25T11:42:50Z Fixed. |
View / edit / reply to this conversation on ReviewNB fonnesbeck commented on 2024-09-25T03:08:53Z typo in first sentence: individual NathanielF commented on 2024-09-25T11:42:59Z Fixed. |
View / edit / reply to this conversation on ReviewNB fonnesbeck commented on 2024-09-25T03:08:53Z Typo: each NathanielF commented on 2024-09-25T11:43:11Z Fixed |
View / edit / reply to this conversation on ReviewNB fonnesbeck commented on 2024-09-25T03:08:54Z What about measures of relative fit among the models? What do the LOO/WAIC values look like, and are they helpful in selecting the appropriate level of complexity? NathanielF commented on 2024-09-25T11:45:26Z Added the global fit comparison for the SEM and full measurement models. The LOO metrics are quite close, but the full measurement model "wins" on this score. I added a note to say we need to consider the value of the trade-off between expressive power of the SEMs and the questions we can answer in the context of simple global fit comparisons. |
Signed-off-by: Nathaniel <[email protected]>
Good idea. View entire conversation on ReviewNB |
changed. View entire conversation on ReviewNB |
Added links to wikipedia. View entire conversation on ReviewNB |
Fixed. Thanks, good catch! View entire conversation on ReviewNB |
It's not used here in this model, but useful to have computed for analysing the correlations between the constructs post model fit. I demonstrate this below for the full measurement model.... View entire conversation on ReviewNB |
Yes, it seemed to help generally boost the ESS. The model samples pretty fast so it was easy enough to just boost the samples. View entire conversation on ReviewNB |
Fixed. View entire conversation on ReviewNB |
Fixed. View entire conversation on ReviewNB |
Fixed View entire conversation on ReviewNB |
Added the global fit comparison for the SEM and full measurement models. The LOO metrics are quite close, but the full measurement model "wins" on this score. I added a note to say we need to consider the value of the trade-off between expressive power of the SEMs and the questions we can answer in the context of simple global fit comparisons. View entire conversation on ReviewNB |
Thanks! View entire conversation on ReviewNB |
Thanks @fonnesbeck I think i've addressed most of the points you raised. But let me know if you think I should add anything else. Note I also re-parameterised the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Sweet! |
Think you'll have to merge that for me @fonnesbeck, i don't have that power. |
Woo! Thanks @fonnesbeck |
* First commit CFA and SEM Signed-off-by: Nathaniel <[email protected]> * test pre-commit hooks Signed-off-by: Nathaniel <[email protected]> * updated for pre-commit Signed-off-by: Nathaniel <[email protected]> * updated git index Signed-off-by: Nathaniel <[email protected]> * update with full run Signed-off-by: Nathaniel <[email protected]> * add some text write up and a pair plot Signed-off-by: Nathaniel <[email protected]> * update with full run and text Signed-off-by: Nathaniel <[email protected]> * Run with explained variance calculations Signed-off-by: Nathaniel <[email protected]> * Add sem structure section Signed-off-by: Nathaniel <[email protected]> * full run with lavaan syntax noted Signed-off-by: Nathaniel <[email protected]> * update with draft conclusion Signed-off-by: Nathaniel <[email protected]> * tigher writing Signed-off-by: Nathaniel <[email protected]> * tidying Signed-off-by: Nathaniel <[email protected]> * emphasis on exchangeability Signed-off-by: Nathaniel <[email protected]> * update plot sizes Signed-off-by: Nathaniel <[email protected]> * add pearl reference Signed-off-by: Nathaniel <[email protected]> * updating with Chris's comments and better parameterisation Signed-off-by: Nathaniel <[email protected]> --------- Signed-off-by: Nathaniel <[email protected]>
* First commit CFA and SEM Signed-off-by: Nathaniel <[email protected]> * test pre-commit hooks Signed-off-by: Nathaniel <[email protected]> * updated for pre-commit Signed-off-by: Nathaniel <[email protected]> * updated git index Signed-off-by: Nathaniel <[email protected]> * update with full run Signed-off-by: Nathaniel <[email protected]> * add some text write up and a pair plot Signed-off-by: Nathaniel <[email protected]> * update with full run and text Signed-off-by: Nathaniel <[email protected]> * Run with explained variance calculations Signed-off-by: Nathaniel <[email protected]> * Add sem structure section Signed-off-by: Nathaniel <[email protected]> * full run with lavaan syntax noted Signed-off-by: Nathaniel <[email protected]> * update with draft conclusion Signed-off-by: Nathaniel <[email protected]> * tigher writing Signed-off-by: Nathaniel <[email protected]> * tidying Signed-off-by: Nathaniel <[email protected]> * emphasis on exchangeability Signed-off-by: Nathaniel <[email protected]> * update plot sizes Signed-off-by: Nathaniel <[email protected]> * add pearl reference Signed-off-by: Nathaniel <[email protected]> * updating with Chris's comments and better parameterisation Signed-off-by: Nathaniel <[email protected]> --------- Signed-off-by: Nathaniel <[email protected]>
CFA and SEM with PyMC
Related to this issue here I'm adding a PR to demonstrate the functionality of CFA and SEM models using PyMC
#695
Helpful links
📚 Documentation preview 📚: https://pymc-examples--698.org.readthedocs.build/en/698/