Skip to contents

A function to fit fixed- or random-effects Bayesian meta-analytic CFAs with minor factors assumed (Uanhoro 2023) . Builds off work by Wu and Browne (2015) . Does not yet accomodate moderators, and covariance matrices must be complete. This will change in the near future.

Usage

meta_mbcfa(
  model = NULL,
  data = NULL,
  group = NULL,
  sample_cov = NULL,
  sample_nobs = NULL,
  method = "normal",
  type = "re",
  orthogonal = FALSE,
  simple_struc = TRUE,
  seed = 12345,
  warmup = 1000,
  sampling = 1000,
  refresh = (warmup + sampling)/10,
  adapt_delta = 0.9,
  max_treedepth = 10,
  chains = 4,
  ncores = max(parallel::detectCores() - 2, 1),
  priors = new_mbsempriors(),
  show = TRUE,
  show_messages = TRUE,
  cluster = NULL,
  target = "rstan"
)

Arguments

model

A description of the user-specified model, lavaan syntax.

data

An optional data frame containing the observed variables used in the model.

group

An optional string identifying the grouping variable in the data object.

sample_cov

(list of matrices) sample variance-covariance matrices. The rownames and/or colnames must contain the observed variable names. For now, assumes there are no missing elements in the covariance matrices.

sample_nobs

(vector of positive integer) Number of observations for each study.

method

(character) One of "normal", "lasso", "logistic", "GDP", or "none". See details below.

type

(character) One of "fe", "re", or "dep" for fixed-effects, random-effects, and dependent-samples MASEM respectively. The "dep" argument is experimental, see details below.

orthogonal

(logical) constrain factors orthogonal, must be TRUE to fit bifactor models.

simple_struc

(LOGICAL) Only relevant for CFAs. If TRUE: assume simple structure; If FALSE: estimate all cross-loadings using generalized double Pareto priors.

seed

(positive integer) seed, set to obtain replicable results.

warmup

(positive integer) The number of warmup iterations to run per chain.

sampling

(positive integer) The number of post-warmup iterations to run per chain, retained for inference.

refresh

(positive integer) How often to print the status of the sampler.

adapt_delta

(real in (0, 1)) Increase to resolve divergent transitions.

max_treedepth

(positive integer) Increase to resolve problems with maximum tree depth.

chains

(positive integer) The number of Markov chains to run.

ncores

(positive integer) The number of chains to run in parallel.

priors

An object of mbsempriors-class. See new_mbsempriors for more information.

show

(Logical) If TRUE, show table of results, if FALSE, do not show table of results. As an example, use FALSE for simulation studies.

show_messages

(Logical) If TRUE, show messages from Stan sampler, if FALSE, hide messages.

cluster

An optional integer vector identifying the cluster each group belongs to. Asssume there are five groups, the first three belong to cluster 1 and the last two belong to cluster 2, then the argument would be: cluster = c(1, 1, 1, 2, 2). This feature is experimental, see details below.

target

(character) One of "rstan" or "cmdstan". If "cmdstan", CmdStan and CmdStanR need to be installed on the device.

Value

An object of mbsem-class

Details

CFAs assume standardized factors. Latent variable regression models are not yet implemented.

There are different methods for estimating models in this package:

  • normal: under belief that minor factor influences are on average zero with continuous deviations away from zero.

  • lasso: under belief that minor factor influences are largely zero with a small number of non-zero residual covariances.

  • logistic: for similar belief as normal but more readily accomodates extreme outliers.

  • GDP: to mimic a global-local approach, i.e. attempt to shrink near 0 residual covariances to 0 with minimal shrinking for larger residual covariances (Armagan et al. 2013) .

  • none: if intending to ignore the influence of minor factors.

When type = "dep", the user must supply the cluster IDs, see cluster parameter documentation above. However, this feature is experimental and only available when target = "cmdstan". Additionally, the cluster inputs are not validated.

References

Armagan A, Dunson DB, Lee J (2013). “Generalized double Pareto shrinkage.” Statistica Sinica, 23(1), 119--143. ISSN 1017-0405, https://www.ncbi.nlm.nih.gov/pmc/articles/PMC3903426/.

Uanhoro JO (2023). “Hierarchical Covariance Estimation Approach to Meta-Analytic Structural Equation Modeling.” Structural Equation Modeling: A Multidisciplinary Journal, 30(4), 532--546. ISSN 1070-5511, doi:10.1080/10705511.2022.2142128 , 2023-06-19.

Wu H, Browne MW (2015). “Quantifying Adventitious Error in a Covariance Structure as a Random Effect.” Psychometrika, 80(3), 571--600. ISSN 1860-0980, doi:10.1007/s11336-015-9451-3 .

Examples

if (FALSE) {
model_syntax <- "# latent variable definitions
F1 =~ JP1 + JP2 + JP3
F2 =~ JN1 + JN2 + JN4 + JN4
F3 =~ TD1 + TD2"
meta_mbcfa(
  model_syntax,
  sample_cov = issp89$data, sample_nobs = issp89$n
)
model_syntax <- paste0(
  "distress =~ ", paste0("x", 1:14, collapse = " + "), "\n",
  "anxiety =~ ", paste0("x", seq(1, 14, 2), collapse = " + "), "\n",
  "depression =~ ", paste0("x", seq(2, 14, 2), collapse = " + ")
)
meta_mbcfa(
  model_syntax,
  sample_cov = Norton13$data, sample_nobs = Norton13$n, orthogonal = TRUE
)
}