Structural Equation modelling is most compellingly conducted in a Bayesian Setting. Bayesian inference done right, adheres to transparent workflow.
SEM modelling in PyMC enables us to automate much of this workflow of model evaluation, and parameter recovery even with complex hierarchical SEM models.
Agenda
The Idea of a Workflow:
Craft versus Checklist
Job Satisfaction
Bayesian Workflow with SEMs:
Confirmatory Factor Structures
Adding Structural Relations
Adding Covariance Structure
Conclusion
Craft and Statistical Workflow
Technical Appendix
Adding Hierarchical Structure
Parameter Recovery and Model Validation
The Idea of a Workflow
Craft in Statistical Modelling
Embraces process, imperfection, and iteration.
Aims at the acquisition of scientific knowledge
Supports generalisable findings and solutions
Restore ownership: you shape, test, and refine — the model carries your imprint.
Checklists in Statistical Modelling
Reduce inquiry to compliance: ticking boxes replaces genuine understanding.
Create the illusion of rigor while bypassing uncertainty and context.
Confuse progress with throughput: more boxes checked ≠ better science.
Strip away ownership: you don’t make something, you just complete a task.
Job Satisfaction Data
Constructive Thought Strategies (CTS): Thought patterns that are positive or helpful, such as:
Self-Talk (positive internal dialogue): ST
Mental Imagery (visualizing successful performance or outcomes): MI
Richly Parameterised Regressions with Expressive Encodings of Measurement Error and Latent Constructs
The SEM workflow
Start with Confirmatory Factor Analysis (CFA):
Validate that our measurement model holds.
Ensure latent constructs are reliably represented by observed indicators.
Layer Structural Paths:
Add theoretically-motivated regressions between constructs.
Assess whether hypothesized relationships improve model fit.
Refine with Residual Covariances:
Account for specific shared variance not captured by factors.
Keep structure transparent while improving realism.
Iterative Validation:
Each step asks: Does this addition honor theory? Improve fit?
Workflow = constant negotiation between parsimony and fidelity.
Job Satisfaction Data
JW1
JW2
JW3
UF1
UF2
FOR
DA1
DA2
DA3
EBA
ST
MI
0
2.366477
0.833993
1.110207
-0.042910
0.286248
-0.429474
-0.516796
-0.259951
-1.087800
0.376052
-0.709829
1.102294
1
1.672558
1.155145
-0.171747
0.089700
0.355399
-0.334075
-0.614280
-0.628377
0.115069
0.958580
0.355393
0.704513
2
0.323188
-0.123037
0.606947
-0.179602
-0.683779
-0.440149
-0.467079
-0.324667
-0.137883
0.039716
0.269033
-0.402309
3
2.029101
0.947978
1.359499
0.419279
0.334296
0.674745
0.300717
0.177310
0.569042
-0.681975
-1.103160
-0.927570
4
0.748337
0.228414
0.430032
0.514564
0.903000
-0.055542
0.167360
-0.789479
-0.203439
0.262900
-0.312303
-0.222812
The Data for SEM modelling is a multivariate data structure with natural theor-driven categories of variables which reflect some mis-measured latent factor.
Mean Structure Parameters \(\tau\) show poor identification
Beta coefficients and Factor Loading Estimates consistent with prior models
Posterior Predictive check on Residuals provide evidence of a good fit.
Bayesian Workflow with SEMs
Assessing the Indirect Effects
Bayesian Workflow with SEMs
Comparing Model Estimates
The measurement model is stable: adding the structural paths did not disrupt how the latent variables are measured.
SEM is not introducing distortions into the factor structure.
The hypothesized regression paths are consistent with the observed covariance patterns.
Constructive thought processes: self-talk, visualisation and evaluation of beliefs improve job satisfaction.
Workflow and Craft
Craft as Discovery
“Abandon the idea of predetermination, the shaping force of your intentions…rely less on the priority of your intentions and more on the immediacy of writing… You’ll see that some of your sentences are still conjectural… start noticing the thoughts and implications surrounding them.” - Verlyn Klinkenborg in Several Short Sentences about Writing”
Modeling, like writing, is an act of exploration.
Expect surprises and anomalies—they teach more than preconceptions.
Embrace uncertainty; allow the data to guide the process.
Craft as Discipline
” [T]he goal is to represent the systematic relationships between the variables and between the variables and the parameters … Discrepancies between the model and data can be used to learn about the ways in which the model is inadequate for the scientific purposes at hand, and thus to motivate expansions and changes to the model … a model is a story of how the data could have been generated; the fitted model should therefore be able to generate synthetic data that look like the real data; failures to do so in important ways indicate faults in the model.” - Gelman & Shalizi in Philosophy and the practice of Bayesian statistics
Building statistical models is inherently iterative and expansionary
Assumptions are encoded transparently and their implications are assessed for cogency
Where our assumptions fail, they are revised or rejected. Building confidence and clarity.
The process yields compelling, justifiable conclusions worthy of your work and effort.