Learn R Programming

psychonetrics (version 0.15)

meta_var1: Meta-analytic VAR(1) model

Description

Single-stage meta-analytic vector autoregressive model (VAR(1)) for time-series data collected across multiple studies. Pools temporal (lag-1) and contemporaneous network structures across studies using a random-effects framework. The meta_gvar wrapper sets contemporaneous = "ggm" for graphical VAR estimation.

Usage

meta_var1(data, covs, nobs,
          vars, studyvar, idvar, dayvar, beepvar,
          contemporaneous = c("cov", "chol", "prec", "ggm"),
          beta = "full",
          omega_zeta = "full", delta_zeta = "full",
          kappa_zeta = "full", sigma_zeta = "full",
          lowertri_zeta = "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",
          Vmats,
          Vmethod = c("individual", "pooled"),
          Vestimation = c("averaged", "per_study"),
          baseline_saturated = TRUE, optimizer,
          estimator = c("FIML", "ML"),
          sampleStats, verbose = FALSE,
          bootstrap = FALSE, boot_sub, boot_resample)

meta_gvar(...)

Value

An object of the class psychonetrics (psychonetrics-class)

Arguments

data

A data frame containing time-series data for multiple studies. Use together with studyvar to identify studies.

covs

A list of pre-computed Toeplitz covariance matrices (one per study). Each matrix should have dimension 2p x 2p where p is the number of variables, with the first p rows/columns being lagged variables and the second p being current variables. Alternative to data.

nobs

A vector with the number of observations per study. Required when covs is supplied.

vars

Character vector of observed variable names. If missing, inferred from data.

studyvar

A string indicating the column name in data that identifies the study. Required when data is supplied. If not supplied but idvar is, idvar is used as studyvar with a warning.

idvar

Optional string indicating the subject ID column within each study. When both studyvar and idvar are supplied, data is first split by studyvar, then idvar is used within each study to collate time series (as in var1).

dayvar

Optional string indicating the day variable (passed to tsData per study).

beepvar

Optional string indicating the beep variable within day (passed to tsData per study).

contemporaneous

Parameterization of the contemporaneous (residual innovation) covariance structure. One of "cov", "chol", "prec", or "ggm".

beta

Temporal lag-1 regression matrix specification. Defaults to "full" (all elements free, including diagonal autoregressive effects).

omega_zeta

Contemporaneous partial correlation matrix specification (used when contemporaneous = "ggm").

delta_zeta

Contemporaneous scaling matrix specification (used when contemporaneous = "ggm").

kappa_zeta

Contemporaneous precision matrix specification (used when contemporaneous = "prec").

sigma_zeta

Contemporaneous covariance matrix specification (used when contemporaneous = "cov").

lowertri_zeta

Contemporaneous Cholesky factor specification (used when contemporaneous = "chol").

randomEffects

Parameterization of the random effects covariance structure.

sigma_randomEffects

Random effects covariance matrix specification (used when randomEffects = "cov").

kappa_randomEffects

Random effects precision matrix specification (used when randomEffects = "prec").

omega_randomEffects

Random effects partial correlation matrix specification (used when randomEffects = "ggm").

lowertri_randomEffects

Random effects Cholesky factor specification (used when randomEffects = "chol").

delta_randomEffects

Random effects scaling matrix specification (used when randomEffects = "ggm").

rho_randomEffects

Random effects correlation matrix specification (used when randomEffects = "cor").

SD_randomEffects

Random effects standard deviation matrix specification (used when randomEffects = "cor").

Vmats

Optional list with 'V' matrices (sampling error variance approximations).

Vmethod

Which method should be used to approximate the sampling error variance? "individual" or "pooled".

Vestimation

How should the sampling error estimates be evaluated? "averaged" or "per_study".

baseline_saturated

Logical indicating if baseline and saturated models should be included.

optimizer

The optimizer to be used. Defaults to "nlminb".

estimator

The estimator to be used. "ML" or "FIML" (default).

sampleStats

Optional sample statistics object.

verbose

Logical, should progress be printed?

bootstrap

Should the data be bootstrapped?

boot_sub

Proportion of cases to subsample for bootstrap.

boot_resample

Logical, should bootstrap be with replacement?

...

Arguments sent to meta_var1.

Author

Sacha Epskamp <mail@sachaepskamp.com>

Details

This function implements a single-stage meta-analytic VAR(1) model. For p observed variables, each study's time-series data is transformed into a Toeplitz covariance structure from which two blocks are extracted:

  • Sigma_0: the p x p stationary covariance (symmetric, p(p+1)/2 unique elements)

  • Sigma_1: the p x p lag-1 cross-covariance (non-symmetric, p^2 elements)

The VAR(1) structural model implies: $$\textrm{vec}(\Sigma_0) = (I - \beta \otimes \beta)^{-1} \textrm{vec}(\Sigma_\zeta)$$ $$\Sigma_1 = \beta \Sigma_0$$

The meta-level mean is \(\mu = [\textrm{vech}(\Sigma_0), \textrm{vec}(\Sigma_1)]\) and heterogeneity is modeled as \(\Sigma = \Sigma^{(\textrm{ran})} + V\).

Note: the exogenous (lagged) covariance block from the full Toeplitz matrix is not modeled, as it is a nuisance parameter at the meta-analytic level.

See Also

var1, meta_varcov, meta_lvm

Examples

Run this code
if (FALSE) {
library(mlVAR)
set.seed(42)
Model <- mlVARsim(nPerson = 50, nNode = 3, nTime = 50, lag = 1)

# Fit meta-analytic VAR(1):
mod <- meta_var1(Model$Data,
                 vars = Model$varNames,
                 studyvar = Model$idvar,
                 estimator = "ML")
mod <- mod %>% runmodel

# Inspect results:
print(mod)
getmatrix(mod, "beta")

# Fit meta-analytic GVAR (with GGM contemporaneous):
mod_gvar <- meta_gvar(Model$Data,
                      vars = Model$varNames,
                      studyvar = Model$idvar,
                      estimator = "ML")
mod_gvar <- mod_gvar %>% runmodel
getmatrix(mod_gvar, "omega_zeta")
}

Run the code above in your browser using DataLab