Bayesian Workflow with Structural Equation Models
Bayesian Workflow
In this project I demonstrated how to fit an escalating series of structural equation models. Emphasising the iterative and expansionary method of model fit and assessment as recommended in the contemporary Bayesian workflow.
The project culminated in a publication to the official PyMC documentation that can be found online here or downloaded as notebook here

The central argument posits that statistical modeling should be approached as a craft — a deliberate, iterative, and transparent process aimed at deep understanding — rather than a game of optimizing performance metrics. The Bayesian workflow, with its cycle of hypothesis, simulation, checking, and expansion, provides the ideal framework for this craft-based approach, a philosophy independently supported by the staggered model development strategies within the SEM literature.
The analysis demonstrates this synthesis through a job satisfaction model, progressively layering complexity from a basic Confirmatory Factor Analysis (CFA) to a full SEM. A key technical finding emerges from comparing different model formulations: the Marginal Formulation, which integrates out latent variables, proved more computationally robust and resolved sampler issues encountered with the more direct Conditional Formulation.
Furthermore, the document highlights the expressive power of Bayesian SEMs through advanced extensions. A Hierarchical SEM is used to model how structural relationships differ across groups, enabling causal inference. An SEM with a Discrete Choice Component demonstrates how to link latent constructs like “job satisfaction” to tangible behavioral outcomes like employee attrition, providing a powerful method for “dual calibration” of expressed attitudes against observed choices. Throughout, the critical role of validation techniques, particularly parameter recovery simulations, is emphasized as an essential step for ensuring a model is well-specified and its parameters are identifiable. The preferred model, the Marginal SEM, is selected not just for its performance metrics but for its combination of plausible results, computational efficiency, and parsimonious structure, embodying the core principles of the craft-based workflow.
