Approximate Bayesian inference for Structural Equation Models (SEM): The INLA approach

IMPS 2026 @ Yonsei Univeristy, Seoul

Haziq Jamil

Research Specialist
BAYESCOMP @ CEMSE-KAUST

https://haziqj.ml/imps26 | 📥 PDF

Håvard Rue

Professor of Statistics
BAYESCOMP @ CEMSE-KAUST

July 22, 2026

Integrated Nested Laplace Approximations

INLA provides a fast, deterministic alternative to MCMC for performing accurate Bayesian inference on a wide class of latent Gaussian models.

Rue et al. (2009)

Structural Equation Models using INLA

  • For \(s=1\!:\!n\), MVN-SEM equations are \[ \DeclareMathOperator*{\argmax}{argmax} \DeclareMathOperator*{\argmin}{argmin} \newcommand{\N}{\mathrm{N}} \newcommand{\SN}{\mathrm{SN}} \begin{gathered} \mathbf y_s = {\boldsymbol\nu +\,} {\boldsymbol\Lambda} \boldsymbol\eta_s + \boldsymbol\epsilon_s \\ \boldsymbol\eta_s = {\boldsymbol\alpha +\,} { \boldsymbol B} \boldsymbol\eta_s + \boldsymbol\zeta_s \end{gathered} \] with assumptions \(\boldsymbol\epsilon_s \sim \N(\mathbf 0,\boldsymbol\Theta)\), \(\boldsymbol\eta_s \sim \N(\mathbf 0,\boldsymbol\Psi)\), \(\operatorname{Cov}(\boldsymbol\epsilon_s,\boldsymbol\eta_s)=\mathbf 0\).

  • Additionally, Bayesian: \(\mathbb R^m \ni \boldsymbol\vartheta \sim \pi(\boldsymbol\vartheta)\).

  • SEM is an LGM! Can use R-INLA out of the box. However…
    • INLA likes sparse precision matrices.
    • Complexity increases with \(n\) and \(m\).
    • Complicated R interface for SEM.
  • R-INLA fitting time: \(n=75 \to\) 6s, \(n=750 \to\) 11s, \(n=7500 \to\) 125s.

INLAvaan

mod <- "
  ind60 =~ x1 + x2 + x3
  dem60 =~ y1 + y2 + y3 + 1.5*y4
  dem65 =~ y5 + y6 + y7 + y8

  dem60 ~ ind60
  dem65 ~ ind60 + dem60

  y1 ~~ y5
  y2 ~~ y4 + y6
  y3 ~~ y7
  y4 ~~ y8
  y6 ~~ y8
"
fit <- INLAvaan::asem(
  model = mod, 
  data  = PoliticalDemocracy
)

  • 🔐 LVs \(\boldsymbol\eta\) analytically integrates out
  • Ground up INLA implementation
    • (b)lavaan syntax and methods.
    • asem(), acfa(), agrowth() with dp = priors_for() option.
    • Very fast—complexity \(\uparrow\) with \(m\) only!

Comparison with MCMC

Global Laplace & VB correction

  • Consider the (unnormalised) posterior density function \(\pi(\boldsymbol\vartheta \mid \mathbf y) \propto \pi(\mathbf y \mid \boldsymbol\vartheta) \, \pi(\boldsymbol\vartheta)\). From a 2nd order Taylor expansion about \(\boldsymbol\vartheta^* = \argmax_{\boldsymbol\vartheta} \log \pi(\boldsymbol\vartheta \mid \mathbf y)\), \[ \log \pi(\boldsymbol\vartheta \mid \mathbf y) \approx \log \pi(\boldsymbol\vartheta^* \mid \mathbf y) - \frac12 (\boldsymbol\vartheta - \boldsymbol\vartheta^*)^\top \boldsymbol\Omega^{-1} (\boldsymbol\vartheta - \boldsymbol\vartheta^*), \] clearly able to approximate the posterior by \(\N(\boldsymbol\vartheta^*, \boldsymbol\Omega)\), where \[ \boldsymbol\Omega^{-1} = -\nabla_{\boldsymbol\vartheta}^2 \log \pi(\boldsymbol\vartheta \mid \mathbf y) \big|_{\boldsymbol\vartheta=\boldsymbol\vartheta^*}. \]
  • Correct the mean of the Laplace using Variational Bayes, which minimises information loss (Zellner, 1988): \[ \hat{\boldsymbol\delta} = \argmin_{\boldsymbol\delta} D_{\text{KL}}\big( \mathcal N(\cdot \, ; \boldsymbol\vartheta^* + \boldsymbol\delta, \boldsymbol\Omega) \;\Vert\; \pi(\cdot \mid \mathbf y) \big). \]

  • Laplace gets the shape (curvature) right, but often the location wrong. Avoid the massive cost of (re-)optimising \(\boldsymbol\Omega\) (van Niekerk & Rue, 2024).

Approximate posterior marginals

  • Use the Laplace approximation again, this time to approximate an integral: \[ \pi(\vartheta_j \mid \mathbf y) = \int_{\mathbb R^{m-1}} \!\!\!\!\!\! e^{\log \pi(\vartheta_j, \boldsymbol\vartheta_{-j} \mid \mathbf y)} \, d \boldsymbol\vartheta_{-j} \,\approx (2\pi)^{\frac{m-1}{2}} \times \overbrace{\pi(\vartheta_j, \boldsymbol\vartheta_{-j}^* \mid \mathbf y)}^{\text{height}} \times \overbrace{\left| \mathbf H_{-j}(\vartheta_j) \right|^{-1/2 }}^{\text{(cond.) width}} \] NB: The true posterior density is being marginalised, not the global Laplace density.

  • This is expensive to compute, as for every \(\vartheta_j\) evaluation, need

    1. An optimisation of \(\boldsymbol\vartheta_{-j}\) at this location; and
    2. The (log) determinant of the Hessian there.
  • Suppose \((\vartheta_{j}, \pi_{j})\) pairs are obtained, perform least squares curve fitting of skew-normal distributions \[\pi(\vartheta_j \mid \mathbf y) \approx \SN(\hat\xi,\hat\omega,\hat\alpha).\]

Approximate posterior marginals (cont.)

Lemma 1 (Conditional Mean Path) = No need for reoptimisation

Let \(\small \boldsymbol\vartheta\sim\N_m(\boldsymbol\vartheta^*,\boldsymbol\Omega)\) with \(\small\boldsymbol\Omega \succ \mathbf 0\). Then the marginal density of the \(\small j\)th component, \(\small j=1,\dots,m\), is proportional to the joint density evaluated along its CMP: \[ \small \pi(\vartheta_j=x) \propto \pi\big(\vartheta_j=x, \, \boldsymbol\vartheta_{-j} = \operatorname{E}[ \boldsymbol\vartheta_{-j} \mid \vartheta_j=x] \big). \]

Lemma 2 (Efficient volume correction) = No need to factor dense Hessian

Along the CMP, \(\small\log \big|\mathbf H_{-j}(\boldsymbol\vartheta(t))\big| \approx \text{const.} + \gamma_j\, t\). Writing \(\small\mathbf g(\boldsymbol\vartheta) = -\nabla_{\boldsymbol\vartheta} \log \pi(\boldsymbol\vartheta \mid \mathbf y)\), \(\small\mathbf L\) the Cholesky factor of \(\small\boldsymbol\Omega\), and \(\small\mathbf v_j = \boldsymbol\Omega_{\cdot j} / \Omega_{jj}\) (the path direction from Lemma 1), \(\small\gamma_j\) is a sum of Hessian-vector products:

\[ \small \gamma_j = -\frac12\sum_{k=1}^{m} \frac{d}{dt}\Big[\mathbf L_{\cdot k}^\top \, \tfrac{d}{d\mathbf L_{\cdot k}}\mathbf g(\boldsymbol\vartheta(t))\Big]_{t=0} \;+\; \frac12\, \frac{d}{dt}\Big[\mathbf v_j^\top \, \tfrac{d}{d\mathbf v_j}\mathbf g(\boldsymbol\vartheta(t))\Big]_{t=0} \]

Gaussian copula sampling

\[ \underbrace{\mathbf z \sim N(\mathbf 0, \mathbf R)}_{\text{Gaussian correlation}} \xrightarrow{\ \Phi(\cdot) \ } \underbrace{\mathbf u}_{\ \text{Uniform} \ } \xrightarrow{ \ F_{\text{SN}}^{-1}(\cdot) \ } \underbrace{\boldsymbol\vartheta}_{\text{SN Marginals}} \xrightarrow{ \ h(\cdot) \ } \text{trans. params.} \]

  • Reconstruct joint posterior samples \(h(\boldsymbol\vartheta^{(b)})\) using a Copula (Nelsen, 2006), preserving Gaussian correlations: \[ \mathbf R = \mathbf D^{-1/2} \boldsymbol \Omega \mathbf D^{-1/2}, \qquad \mathbf D = \operatorname{diag}(\boldsymbol\Omega). \]

  • Under skewness (i.e. \(\alpha_j \neq 0\)), nonlinear quantile transforms are distorted. Fix: NORTA algorithm (NORmal To Anything, Cario & Nelson, 1997).

  • This also allows us to derive approximate posteriors for

    1. Posterior Predictive P-value (PPP), e.g. \(\#\{ T(\mathbf S_{\text{obs}}, \boldsymbol\Sigma(\boldsymbol\vartheta^{(b)})) > T(\mathbf S_{\text{rep}}^{(b)}, \boldsymbol\Sigma(\boldsymbol\vartheta^{(b)})) \}\).
    2. Factor scores, \(\boldsymbol\eta^{(b)} \mid \boldsymbol\vartheta^{(b)} \sim \N_q(\mathbf m(\boldsymbol\vartheta^{(b)}), \mathbf V(\boldsymbol\vartheta^{(b)}))\) \(\rightsquigarrow \pi(\boldsymbol\eta \mid y)\).
    3. Prediction and imputation.

(b)lavaan S4 methods

print(fit) # and also summary()
INLAvaan 0.3.1 ended normally after 75 iterations

  Estimator                                      BAYES
  Optimization method                           NLMINB
  Number of model parameters                        30

  Number of observations                            75

Model Test (User Model):

   Marginal log-likelihood                   -1696.372 
   PPP (Chi-square)                              0.000 

Also available:

  • fitmeasures(), loo(), waic(), compare()
  • predict(), sampling(), simulate()
  • standardisedsolution()
  • vcov()
  • plot()
coef(fit)
   ind60=~x2    ind60=~x3    dem60=~y2    dem60=~y3    dem65=~y6    dem65=~y7 
       2.222        1.842        0.648        1.018        1.164        1.273 
   dem65=~y8  dem60~ind60  dem65~ind60  dem65~dem60       y1~~y5       y2~~y4 
       1.073        1.304        0.812        0.760        0.434        4.864 
      y2~~y6       y3~~y7       y8~~y4       y6~~y8       x1~~x1       x2~~x2 
       2.230        0.958        1.414        1.475        0.090        0.131 
      x3~~x3       y1~~y1       y2~~y2       y3~~y3       y5~~y5       y6~~y6 
       0.507        1.531        9.952        5.444        2.370        5.408 
      y7~~y7       y8~~y8       y4~~y4 ind60~~ind60 dem60~~dem60 dem65~~dem65 
       3.791        4.082       11.008        0.460        4.852        0.462 

Parameter recovery from simulated data

Effects of prior distributions (\(n=75\))

  • Loadings: \(\lambda \sim \N(0,10^2) \rightsquigarrow \lambda \sim \N(3,0.1^2)\)

  • Latent variances: \(\psi^{1/2} \sim \Gamma(1,0.5) \rightsquigarrow \psi \sim \Gamma(100,50)\)

Outro

  • 🚀 INLA methodology offers a rapid alternative for SEM, delivering Bayesian results at near the speed of frequentist estimators.
    • Not aiming to replace MCMC; use case is model development, testing, and exploratory analysis.

  • Vignettes and tutorials available on https://inlavaan.haziqj.ml/: Equality constraints, defined parameters, multigroup, multilevel, and missing data.

감사합니다

https://haziqj.ml/imps26

  • Jamil, H., & Rue, H. (2026a). Approximate Bayesian inference for structural equation models using integrated nested Laplace approximations (2603.25690 [stat.ME]). arXiv. DOI: 10.48550/arXiv.2603.25690
  • Jamil, H., & Rue, H. (2026b). Implementation and workflows for INLA-based approximate Bayesian structural equation modelling (2604.00671 [stat.CO]). arXiv. DOI: 10.48550/arXiv.2604.00671

References

Bollen, K. A. (1989). Structural equations with latent variables (pp. xiv, 514). John Wiley & Sons. https://doi.org/10.1002/9781118619179
Cario, M. C., & Nelson, B. L. (1997). Modeling and generating random vectors with arbitrary marginal distributions and correlation matrix. Department of Industrial Engineering and Management, Northwestern University, Evanston.
Freni-Sterrantino, A., Rustand, D., Van Niekerk, J., Krainski, E., & Rue, H. (2025). A graphical framework for interpretable correlation matrix models for multivariate regression. Statistical Methods & Applications, 34(3), 409–447. https://doi.org/10.1007/s10260-025-00788-y
Jamil, H., & Rue, H. (2026a). Approximate Bayesian inference for structural equation models using integrated nested Laplace approximations (2603.25690 [stat.ME]). arXiv. https://doi.org/10.48550/arXiv.2603.25690
Jamil, H., & Rue, H. (2026b). Implementation and workflows for INLA-based approximate Bayesian structural equation modelling (2604.00671 [stat.CO]). arXiv. https://doi.org/10.48550/arXiv.2604.00671
Krainski, E., Gómez-Rubio, V., Bakka, H., Lenzi, A., Castro-Camilo, D., Simpson, D., Lindgren, F., & Rue, H. (2018). Advanced spatial modeling with stochastic partial differential equations using R and INLA. Chapman and Hall/CRC.
Nelsen, R. B. (2006). An introduction to copulas (2nd ed). Springer.
Rue, H., Martino, S., & Chopin, N. (2009). Approximate Bayesian Inference for Latent Gaussian models by using Integrated Nested Laplace Approximations. Journal of the Royal Statistical Society Series B: Statistical Methodology, 71(2), 319–392. https://doi.org/10.1111/j.1467-9868.2008.00700.x
Simpson, D., Rue, H., Riebler, A., Martins, T. G., & Sørbye, S. H. (2017). Penalising Model Component Complexity: A Principled, Practical Approach to Constructing Priors. Statistical Science, 32(1), 1–28. https://doi.org/10.1214/16-STS576
van Niekerk, J., & Rue, H. (2024). Low-rank Variational Bayes correction to the Laplace method. Journal of Machine Learning Research.
Zellner, A. (1988). Optimal Information Processing and Bayes’s Theorem. The American Statistician, 42(4), 278–280. https://doi.org/10.2307/2685143