Learn R Programming

psychonetrics (version 0.17.8)

meta_varcov: Variance-covariance and GGM meta analysis

Description

Meta analysis of correlation matrices to fit a homogenous correlation matrix or Gaussian graphical model. Based on meta-analytic SEM (Jak and Cheung, 2019).

Usage

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(...)

Value

An object of the class psychonetrics (psychonetrics-class)

Arguments

cors

A list of correlation matrices. Must contain rows and columns with NAs for variables not included in a study.

nobs

A vector with the number of observations per study.

data

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.

covs

A list of covariance matrices. Alternative to cors; when supplied, corinput defaults to FALSE.

studyvar

A string indicating the column name in data that identifies the study. Required when data is supplied.

groups

Deprecated. Use groupvar instead. Multi-group support is not yet included for meta-analytic models.

groupvar

Not yet supported for meta-analytic models. Supplying this argument will produce an error.

corinput

Logical. Defaults to TRUE when cors is used, FALSE when covs is used. Controls whether the input is treated as correlation matrices.

Vmats

Optional list with 'V' matrices (sampling error variance approximations). May not be combined with an explicitly supplied Vmethod (which would otherwise silently be ignored).

Vmethod

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.

Vestimation

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).

type

What to model? Currently only "cor" and "ggm" are supported.

sigma_y

Reserved covariance-matrix specification. Not used for the currently supported values of type ("cor" and "ggm"); retained for internal use and forward compatibility.

kappa_y

Reserved precision-matrix specification. Not used for the currently supported values of type ("cor" and "ggm"); retained for internal use and forward compatibility.

omega_y

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.

lowertri_y

Reserved Cholesky-factor specification. Not used for the currently supported values of type ("cor" and "ggm"); retained for internal use and forward compatibility.

delta_y

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.

rho_y

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.

SD_y

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.

randomEffects

What to model for the random effects?

sigma_randomEffects

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.

kappa_randomEffects

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.

omega_randomEffects

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.

lowertri_randomEffects

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.

delta_randomEffects

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.

rho_randomEffects

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.

SD_randomEffects

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.

vars

Variables to be included.

baseline_saturated

A logical indicating if the baseline and saturated model should be included. Mostly used internally and NOT Recommended to be used manually.

optimizer

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".

estimator

The estimator to be used. Currently implemented are "ML" for maximum likelihood estimation or "FIML" for full-information maximum likelihood estimation.

sampleStats

An optional sample statistics object. Mostly used internally.

verbose

Logical, should progress be printed to the console?

bootstrap

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).

boot_sub

Proportion of cases to be subsampled (round(boot_sub * N)).

boot_resample

Logical, should the bootstrap be with replacement (TRUE) or without replacement (FALSE)

...

Arguments sent to meta_varcov

Author

Sacha Epskamp <mail@sachaepskamp.com>

Details

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.

References

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.

Examples

Run this code
# \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