Single-stage meta-analytic latent variable model (LVM) for covariance or correlation matrices. Combines a latent variable model (CFA/SEM) for the mean structure with a random-effects model for between-study heterogeneity. Based on the MAGNA framework (Epskamp et al., 2024).
meta_lvm(covs, nobs, data, cors, studyvar, groups, groupvar,
corinput, Vmats, Vmethod = c("individual", "pooled",
"metaSEM_individual", "metaSEM_weighted"), Vestimation
= c("averaged", "per_study"),
lambda, beta = "zero",
latent = c("cov", "chol", "prec", "ggm"),
sigma_zeta = "full", kappa_zeta = "full",
omega_zeta = "full", lowertri_zeta = "full",
delta_zeta = "full",
residual = c("cov", "chol", "prec", "ggm"),
sigma_epsilon = "diag", kappa_epsilon = "diag",
omega_epsilon = "zero", lowertri_epsilon = "diag",
delta_epsilon = "diag",
identify = TRUE,
identification = c("loadings", "variance"),
randomEffects = c("chol", "cov", "prec", "ggm", "cor"),
sigma_randomEffects = "full",
kappa_randomEffects = "full",
omega_randomEffects = "full",
lowertri_randomEffects = "full",
delta_randomEffects = "full",
rho_randomEffects = "full",
SD_randomEffects = "full",
vars, latents,
baseline_saturated = TRUE, optimizer,
estimator = c("FIML", "ML"),
sampleStats, verbose = FALSE,
bootstrap = FALSE, boot_sub, boot_resample)An object of the class psychonetrics (psychonetrics-class)
A list of covariance or correlation matrices. Must contain rows and columns with NAs for variables not included in a study.
A vector with the number of observations per study.
Optional data frame. When supplied together with studyvar, covariance matrices and sample sizes are computed internally per study. Cannot be used together with covs, cors, or nobs.
A list of correlation matrices. When supplied, the matrices are treated as covariance matrices with a warning (appropriate for standardized data). Requires nobs.
A string indicating the column name in data that identifies the study. Required when data is supplied.
Deprecated. Use groupvar instead. Multi-group support is not yet included for meta-analytic models.
Not yet supported for meta-analytic models. Supplying this argument will produce an error.
Logical. Defaults to FALSE. Controls whether the input is treated as correlation matrices.
Optional list with 'V' matrices (sampling error variance approximations).
Which method should be used to approximate the sampling error variance?
How should the sampling error estimates be evaluated?
A matrix encoding the factor loading structure. Can be a pattern matrix with TRUE/FALSE or 0/1 entries, or a matrix with starting values and higher integer codes for equality constraints.
Structural (regression) matrix among latent variables. Defaults to "zero".
Parameterization of the latent covariance structure. One of "cov", "chol", "prec", or "ggm".
Latent covariance matrix specification (used when latent = "cov").
Latent precision matrix specification (used when latent = "prec").
Latent partial correlation matrix specification (used when latent = "ggm").
Latent Cholesky factor specification (used when latent = "chol").
Latent scaling matrix specification (used when latent = "ggm").
Parameterization of the residual covariance structure. One of "cov", "chol", "prec", or "ggm".
Residual covariance matrix specification (used when residual = "cov"). Defaults to "diag". Diagonal elements are always fixed (derived from the correlation constraint).
Residual precision matrix specification (used when residual = "prec").
Residual partial correlation matrix specification (used when residual = "ggm").
Residual Cholesky factor specification (used when residual = "chol").
Residual scaling matrix specification (used when residual = "ggm").
Logical, should the model be identified? Defaults to TRUE.
How to identify the model. "loadings" or "variance".
Parameterization of the random effects covariance structure.
Random effects covariance matrix specification (used when randomEffects = "cov").
Random effects precision matrix specification (used when randomEffects = "prec").
Random effects partial correlation matrix specification (used when randomEffects = "ggm").
Random effects Cholesky factor specification (used when randomEffects = "chol").
Random effects scaling matrix specification (used when randomEffects = "ggm").
Random effects correlation matrix specification (used when randomEffects = "cor").
Random effects standard deviation matrix specification (used when randomEffects = "cor").
Character vector of observed variable names. If missing, names are taken from the correlation matrices.
Character vector of latent variable names.
Logical indicating if baseline and saturated models should be included.
The optimizer to be used. Defaults to "nlminb".
The estimator to be used. "ML" or "FIML" (default).
Optional sample statistics object.
Logical, should progress be printed?
Should the data be bootstrapped?
Proportion of cases to subsample for bootstrap.
Logical, should bootstrap be with replacement?
Sacha Epskamp <mail@sachaepskamp.com>
This function implements a single-stage meta-analytic latent variable model. The model specifies that the mean of the vectorized correlation matrices follows an LVM-implied correlation structure:
$$\mu = \textrm{vechs}(\Lambda (I-B)^{-1} \Sigma_\zeta (I-B)^{-\top} \Lambda' + \Sigma_\varepsilon)$$
where diagonal elements of \(\Sigma_\varepsilon\) are derived from the constraint that \(\mu\) represents correlations (diagonal of implied covariance = 1).
Between-study heterogeneity is modeled as:
$$\Sigma = \Sigma^{(\textrm{ran})} + V$$
where \(V\) is the known sampling error covariance and \(\Sigma^{(\textrm{ran})}\) captures true between-study variation.
Epskamp, S. et al. (2024). Meta-Analytic Gaussian Network Aggregation. Psychometrika.
Jak, S., and Cheung, M. W. L. (2019). Meta-analytic structural equation modeling with moderating effects on SEM parameters. Psychological Methods.
meta_varcov, lvm
if (FALSE) {
# Generate simulated data
set.seed(42)
nStudies <- 10
nvar <- 6
nlat <- 2
# True factor loading matrix
lambda_true <- matrix(0, nvar, nlat)
lambda_true[1:3, 1] <- c(0.7, 0.8, 0.6)
lambda_true[4:6, 2] <- c(0.7, 0.8, 0.6)
# Generate correlation matrices per study
cors <- list()
nobs <- sample(100:400, nStudies)
for (i in 1:nStudies) {
sigma <- lambda_true %*% t(lambda_true) + diag(1 - rowSums(lambda_true^2))
dat <- MASS::mvrnorm(nobs[i], rep(0, nvar), sigma)
cors[[i]] <- cor(dat)
colnames(cors[[i]]) <- rownames(cors[[i]]) <- paste0("V", 1:nvar)
}
# Fit meta-analytic CFA
mod <- meta_lvm(covs = cors, nobs = nobs, lambda = lambda_true != 0)
mod <- mod %>% runmodel
# Inspect results
print(mod)
parameters(mod)
getmatrix(mod, "lambda")
}
Run the code above in your browser using DataLab