
STAT Workshop 2024, KAUST
Assistant Professor in Statistics, Universiti Brunei Darussalam
Visiting Fellow, London School of Economics and Political Science
November 18, 2024

{lavaan} and {blavaan}
The {INLA} team
In a nutshell
Analyse multivariate data \(y=(y_1,\dots,y_p)^\top\) to measure and relate hidden variables \(\eta=(\eta_1,\dots,\eta_q)^\top\), \(q \ll p\), that explain complex patterns within the data.
In the social sciences, LVs are used to represent abstract constructs.




Measurement model

\[\begin{gather} y_i \sim f(\cdot \mid \mu_i,\Theta) \\ g(\mu_i) = \class{ubdblue}{\nu} + \class{ubdred}{\Lambda} \eta_i \\ \eta_i \sim \operatorname{N}_q(0,\Psi) \\ i=1,\dots,n \end{gather}\]
Latent variables |
Manifest Variables |
|
|---|---|---|
| Metrical | Categorical | |
| Metrical | Factor analysis | Latent trait analysis |
| Categorical | Latent profile analysis | Latent class analysis |
Bartholomew, Knott, and Moustaki (2011)
Continuous factor models: \(f \equiv \operatorname{N}_p(\mu_i,\Theta)\) and \(g(x)=x\).
Item Response Theory models: \(f \equiv \operatorname{Cat}_p(\mu_i)\) and \(g(x)=\operatorname{logit}(x)\).
Focus on normal observed and LVs for now.

\[\begin{gather} y_i = \nu + \Lambda \eta_i + \epsilon_i \\ \epsilon_i \sim \operatorname{N}_p(0,\Theta) \\ \eta_i \sim \operatorname{N}_q(0,\Psi) \\ i=1,\dots,n \end{gather}\]

Bollen (1989)
\[\begin{gather} y_i = \nu + \Lambda \eta_i + \epsilon_i \\ \epsilon_i \sim \operatorname{N}_p(0,\Theta) \\ \eta_i \sim \operatorname{N}_q(0,\Psi) \\ i=1,\dots,n \end{gather}\]

Bollen (1989)
\[\begin{gather} y_i = \nu + \Lambda \eta_i + \epsilon_i \\ \epsilon_i \sim \operatorname{N}_p(0,\Theta) \\[0.4em] \eta_i = \alpha + B \eta_i + \zeta_i \\ \zeta_i \sim \operatorname{N}_q(0,\Psi) \\[0.4em] i=1,\dots,n \end{gather}\]

Bollen (1989)
\[\begin{gather} y_i = \nu + \Lambda \eta_i + \epsilon_i \\ \epsilon_i \sim \operatorname{N}_p(0,\Theta) \\[0.4em] \eta_i = \alpha + B \eta_i + \zeta_i \\ \zeta_i \sim \operatorname{N}_q(0,\Psi) \\[0.4em] i=1,\dots,n \end{gather}\]
In the frequentist approach, estimates obtained by minimising discrepancy between \(S\) and \(\Sigma(\kappa)\) (Muthén and Satorra 1995), using
Fast and efficient, with nice asymptotic properties. See, e.g. {lavaan} (Rosseel 2012).
Alternatively, the normal SEM can be viewed as \[\begin{gather} y_i \mid \eta_i \sim \operatorname{N}_p(\nu + \Lambda \eta_i, \Theta)\\ \eta_i \sim \operatorname{N}_q\big(\cancelto{0}{(I-B)^{-1}\alpha}, (I-B)^{-1}\Psi(I-B)^{-\top} \big) \end{gather}\]
Adding suitable priors \(\kappa\sim f(\kappa)\) to the system, this form seems conducive for Bayesian estimation.
{blavaan} (Merkle and Rosseel 2018).{blavaan} uses the marginal model instead, effectively turning SEM into covariance matrix model (Merkle et al. 2021).However, with it of course comes all the challenges: Slow convergence, label switching, sensitivity to priors, etc.


But 🔎👀 Keywords: “Structural Equation Model INLA” and the like… 0 hits.
The SEM structure is also seemingly conducive for INLA (Rue, Martino, and Chopin 2009; van Niekerk et al. 2023). Ingredients:

Rue et al. (2017)

Still working out the kinks, but initial results are promising!


CFA model examining cognitive abilities in children from two different schools (Holzinger and Swineford 1939).
Are constructs measured equivalently across groups?
Three types of measurement invariant models:
Classically, these are formally tested using Likelihood Ratio Test (LRT) or Wald Test (in addition to comparing fit measures).
Under MCMC sampling schemes, we can only afford to perform approximate measurement invariant studies using informative prior distributions.
Using INLA, we can perform exact equality constraints and compare models.
| Invariance | Marg. Log Lik. | DIC | \(p_{\text{eff}}\) |
\(\log_{10}(\text{BF})\) |
|---|---|---|---|---|
| Configural | -4120 | 6942 | 448 | — |
| Weak | -4089 | 6748 | 681 | 13.1 |
| Strong | -4075 | 6824 | 680 | 19.2 |
inla.posterior.sample().
Building a model based on procedural fairness theory, which links trust, legitimacy, and compliance with authorities (Jackson, Bradford, et al. 2011; Jackson, Hough, et al. 2011).
Often, country-level effects are ignored, but they can be crucial in understanding the variability in the latent constructs across countries.
Total \(n=52,458\) respondents from \(m=27\) countries. Example of items measuring the construct “Trust in Police Effectiveness”:
| Ser. | Question |
|---|---|
| D12 | Based on what you have heard or your own experience how successful do you think the police are at preventing crimes in [country] where violence is used or threatened? |
| D13 | How successful do you think the police are at catching people who commit house burglaries in [country]? |
| D14 | If a violent crime were to occur near to where you live and the police were called, how slowly or quickly do you think they would arrive at the scene? |

Let \(i=1,\dots,n_k\) index respondents, \(j=1,\dots,m\) index countries, and \(k=1,\dots,p\) index items. Additionally, let \(l=1,\dots,5\) index the latent factors.
Measurement model: \[\begin{align}
y_{ijk}
&= \lambda_{kl} (\eta_{il} + u_{jl}) + \varepsilon_{ijk} \\
&= \lambda_{kl} \eta_{il} + \tilde u_{jl} + \varepsilon_{ijk}
\end{align}\] where the \(\tilde u_{jl}\) are Gaussian random effects. In {INLA}, we can specify this using an f(i, "iidkd", order = 5) term.

In the educational testing literature, this is so-called two parameter logistic (2PL) model1

{INLA}, we make use of an f(region, model = "besagproper") term with family = "binomial" likelihood.

Could also consider spatially varying differential item functioning (DIF).
If latent traits are of interest, INLA provides this under $summary.random.
INLA is a promising alternative to MCMC sampling for 🚀 estimating Bayesian latent variable models and structural equation models.
Several gaps in {b/lavaan} that are easily filled by {INLA}:
A pivotal advancement in psychometric research, opening doors for innovative modelling of real-world data.
The ultimate goal is to provide an R software implementation for estimating Bayesian SEM using INLA.
{INLAvaan}