Meta analysis of correlation matrices to fit a homogenous correlation matrix or Gaussian graphical model. Based on meta-analytic SEM (Jak and Cheung, 2019).
meta_varcov(cors, nobs, data, covs, studyvar, groups, groupvar,
corinput, Vmats, Vmethod = c("individual", "pooled",
"OS_individual", "OS_pooled",
"metaSEM_individual", "metaSEM_weighted"), Vestimation
= c("averaged", "per_study"), type = c("cor", "ggm"),
sigma_y = "full", kappa_y = "full", omega_y = "full",
lowertri_y = "full", delta_y = "full", rho_y = "full",
SD_y = "full", 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,
baseline_saturated = TRUE, optimizer, estimator =
c("FIML", "ML"), sampleStats, verbose = FALSE,
bootstrap = FALSE, boot_sub, boot_resample)
meta_ggm(...)An object of the class psychonetrics (psychonetrics-class)
A list of 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, correlation matrices and sample sizes are computed internally per study. Cannot be used together with cors, covs, or nobs.
A list of covariance matrices. Alternative to cors; when supplied, corinput defaults to FALSE.
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 TRUE when cors is used, FALSE when covs is used. Controls whether the input is treated as correlation matrices.
Optional list with 'V' matrices (sampling error variance approximations). May not be combined with an explicitly supplied Vmethod (which would otherwise silently be ignored).
Which method should be used to approximate the sampling error variance? One of "individual" (the default; the sampling-error covariance matrix is approximated separately for each study), "pooled" (a single pooled approximation is used for all studies), "OS_individual" or "OS_pooled" (the asymptotic sampling covariance matrix of the sample correlations following Olkin and Siotani, 1976, evaluated per study or at the sample-size-weighted pooled correlation matrix; for covariance input the corresponding Wishart expression is used), "metaSEM_individual", or "metaSEM_weighted". The two metaSEM_* options compute the sampling-error covariances via metaSEM::asyCov and therefore require the Suggests package metaSEM to be installed (per study or using sample-size weighting, respectively). See Details for the difference between the default methods and the OS_* methods.
How should the sampling error estimates be evaluated? Either "averaged" (the default; a single sampling-error covariance matrix is averaged over the studies) or "per_study" (a separate sampling-error covariance matrix is retained for each study).
What to model? Currently only "cor" and "ggm" are supported.
Reserved covariance-matrix specification. Not used for the currently supported values of type ("cor" and "ggm"); retained for internal use and forward compatibility.
Reserved precision-matrix specification. Not used for the currently supported values of type ("cor" and "ggm"); retained for internal use and forward compatibility.
Only used when type = "ggm". Either "full" to estimate every element freely, "zero" to set all elements to zero, or a matrix of the dimensions node x node with 0 encoding a fixed to zero element, 1 encoding a free to estimate element, and higher integers encoding equality constraints. For multiple groups, this argument can be a list or array with each element/slice encoding such a matrix.
Reserved Cholesky-factor specification. Not used for the currently supported values of type ("cor" and "ggm"); retained for internal use and forward compatibility.
Only used when type = "ggm". Either "diag" or "zero" (not recommended), or a matrix of the dimensions node x node with 0 encoding a fixed to zero element, 1 encoding a free to estimate element, and higher integers encoding equality constraints. For multiple groups, this argument can be a list or array with each element/slice encoding such a matrix.
Only used when type = "cor". Either "full" to estimate every element freely, "zero" to set all elements to zero, or a matrix of the dimensions node x node with 0 encoding a fixed to zero element, 1 encoding a free to estimate element, and higher integers encoding equality constraints. For multiple groups, this argument can be a list or array with each element/slice encoding such a matrix.
Only used when type = "cor". Either "diag" or "zero", or a matrix of the dimensions node x node with 0 encoding a fixed to zero element, 1 encoding a free to estimate element, and higher integers encoding equality constraints. For multiple groups, this argument can be a list or array with each element/slice encoding such a matrix.
What to model for the random effects?
Only used when type = "cov". Either "full" to estimate every element freely, "diag" to only include diagonal elements, or a matrix of the dimensions node x node with 0 encoding a fixed to zero element, 1 encoding a free to estimate element, and higher integers encoding equality constraints. For multiple groups, this argument can be a list or array with each element/slice encoding such a matrix.
Only used when randomEffects = "prec". Either "full" to estimate every element freely, "diag" to only include diagonal elements, or a matrix of the dimensions node x node with 0 encoding a fixed to zero element, 1 encoding a free to estimate element, and higher integers encoding equality constraints. For multiple groups, this argument can be a list or array with each element/slice encoding such a matrix.
Only used when randomEffects = "ggm". Either "full" to estimate every element freely, "zero" to set all elements to zero, or a matrix of the dimensions node x node with 0 encoding a fixed to zero element, 1 encoding a free to estimate element, and higher integers encoding equality constraints. For multiple groups, this argument can be a list or array with each element/slice encoding such a matrix.
Only used when randomEffects = "chol". Either "full" to estimate every element freely, "diag" to only include diagonal elements, or a matrix of the dimensions node x node with 0 encoding a fixed to zero element, 1 encoding a free to estimate element, and higher integers encoding equality constraints. For multiple groups, this argument can be a list or array with each element/slice encoding such a matrix.
Only used when randomEffects = "ggm". Either "diag" or "zero", or a matrix of the dimensions node x node with 0 encoding a fixed to zero element, 1 encoding a free to estimate element, and higher integers encoding equality constraints. For multiple groups, this argument can be a list or array with each element/slice encoding such a matrix.
Only used when randomEffects = "cor". Either "full" to estimate every element freely, "zero" to set all elements to zero, or a matrix of the dimensions node x node with 0 encoding a fixed to zero element, 1 encoding a free to estimate element, and higher integers encoding equality constraints. For multiple groups, this argument can be a list or array with each element/slice encoding such a matrix.
Only used when randomEffects = "cor". Either "diag" or "zero", or a matrix of the dimensions node x node with 0 encoding a fixed to zero element, 1 encoding a free to estimate element, and higher integers encoding equality constraints. For multiple groups, this argument can be a list or array with each element/slice encoding such a matrix.
Variables to be included.
A logical indicating if the baseline and saturated model should be included. Mostly used internally and NOT Recommended to be used manually.
The optimizer to be used. Can be one of "nlminb" (the default R nlminb function), "ucminf" (from the optimr package), "nloptr_TNEWTON" (preconditioned truncated Newton via nloptr), and "LBFGS++" (pure C++ L-BFGS-B). Defaults to "nlminb".
The estimator to be used. Currently implemented are "ML" for maximum likelihood estimation or "FIML" for full-information maximum likelihood estimation.
An optional sample statistics object. Mostly used internally.
Logical, should progress be printed to the console?
Should the data be bootstrapped? If TRUE the data are resampled and a bootstrap sample is created. These must be aggregated using aggregate_bootstraps! Can be TRUE or FALSE. Can also be "nonparametric" (which sets boot_sub = 1 and boot_resample = TRUE) or "case" (which sets boot_sub = 0.75 and boot_resample = FALSE).
Proportion of cases to be subsampled (round(boot_sub * N)).
Logical, should the bootstrap be with replacement (TRUE) or without replacement (FALSE)
Arguments sent to meta_varcov
Sacha Epskamp <mail@sachaepskamp.com>
The default sampling-error approximations Vmethod = "individual" and "pooled" invert the Fisher information of a saturated correlation model (with unit diagonal constraint). This is the asymptotic covariance matrix of the maximum-likelihood estimates of a constrained correlation model, which is smaller than the sampling covariance of the raw sample correlations that enter the meta-level data (for a single correlation: (1 - rho^2)^2 / ((1 + rho^2) n) instead of (1 - rho^2)^2 / n). The alternative options Vmethod = "OS_individual" and "OS_pooled" instead use the asymptotic sampling covariance matrix of the sample correlations themselves (Olkin and Siotani, 1976), which matches metaSEM::asyCov and may be preferred when the absolute size of the random-effects (heterogeneity) variances is of interest: with the default methods part of the sampling variability can be absorbed into the random-effects variances, inflating them somewhat. The pooled correlation estimates themselves are typically nearly identical between these choices. The default is kept at "individual" for backward compatibility with published results.
Note that the saturated meta-analytic model (a fully free pooled correlation structure with fully free random effects) has zero degrees of freedom, in which case chi-square based fit indices (e.g., RMSEA, CFI) are not informative and are left blank.
Jak, S., and Cheung, M. W. L. (2019). Meta-analytic structural equation modeling with moderating effects on SEM parameters. Psychological methods.
Olkin, I., and Siotani, M. (1976). Asymptotic distribution of functions of a correlation matrix. In S. Ikeda (Ed.), Essays in probability and statistics (pp. 235-251). Shinko Tsusho.
# \donttest{
# Simulate a list of correlation matrices for several studies:
set.seed(123)
nStudy <- 8
nNode <- 4
trueRho <- diag(nNode)
trueRho[lower.tri(trueRho)] <- trueRho[upper.tri(trueRho)] <- 0.3
nobs <- sample(100:300, nStudy)
cors <- lapply(seq_len(nStudy), function(i){
X <- MASS::mvrnorm(nobs[i], rep(0, nNode), trueRho)
R <- cor(X)
colnames(R) <- rownames(R) <- paste0("V", 1:nNode)
R
})
# Meta-analytic GGM using the list of correlation matrices and sample sizes:
mod <- meta_varcov(cors = cors, nobs = nobs, type = "ggm")
mod <- runmodel(mod)
# Pooled network:
getmatrix(mod, "omega_y")
# }
Run the code above in your browser using DataLab