Multivariate Meta-Analysis of Discrete-Time VAR Estimates (Fixed-Effect Model)
Ivan Jacob Agaloos Pesigan
2024-08-12
Source:vignettes/fit-dt-var-id-fixed.Rmd
fit-dt-var-id-fixed.Rmd
Model
The measurement model is given by where represents a vector of observed variables and a vector of latent variables for individual and time . Since the observed and latent variables are equal, we only generate data from the dynamic structure.
The dynamic structure is given by where , , and are random variables, and , , and are model parameters. Here, is a vector of latent variables at time and individual , represents a vector of latent variables at time and individual , and represents a vector of dynamic noise at time and individual . denotes a vector of intercepts, a matrix of autoregression and cross regression coefficients, and the covariance matrix of .
An alternative representation of the dynamic noise is given by where .
Data Generation
Notation
Let be the number of time points and be the number of individuals.
Let the initial condition be given by
Let the constant vector be given by
Let the transition matrix be given by
Let the dynamic process noise be given by
R Function Arguments
n
#> [1] 10
time
#> [1] 500
mu0
#> [1] 0 0 0
sigma0
#> [,1] [,2] [,3]
#> [1,] 1.0 0.2 0.2
#> [2,] 0.2 1.0 0.2
#> [3,] 0.2 0.2 1.0
sigma0_l
#> [,1] [,2] [,3]
#> [1,] 1.0 0.0000000 0.0000000
#> [2,] 0.2 0.9797959 0.0000000
#> [3,] 0.2 0.1632993 0.9660918
alpha
#> [1] 0 0 0
beta
#> [,1] [,2] [,3]
#> [1,] 0.7 0.0 0.0
#> [2,] 0.5 0.6 0.0
#> [3,] -0.1 0.4 0.5
psi
#> [,1] [,2] [,3]
#> [1,] 0.1 0.0 0.0
#> [2,] 0.0 0.1 0.0
#> [3,] 0.0 0.0 0.1
psi_l
#> [,1] [,2] [,3]
#> [1,] 0.3162278 0.0000000 0.0000000
#> [2,] 0.0000000 0.3162278 0.0000000
#> [3,] 0.0000000 0.0000000 0.3162278
Using the SimSSMVARFixed
Function from the
simStateSpace
Package to Simulate Data
library(simStateSpace)
sim <- SimSSMVARFixed(
n = n,
time = time,
mu0 = mu0,
sigma0_l = sigma0_l,
alpha = alpha,
beta = beta,
psi_l = psi_l
)
data <- as.data.frame(sim)
head(data)
#> id time y1 y2 y3
#> 1 1 0 -1.84569501 0.5815402 0.8057225
#> 2 1 1 -1.34252674 -1.1219724 0.9873906
#> 3 1 2 -0.57123433 -1.1591679 0.1280274
#> 4 1 3 -0.44448720 -0.9783200 -0.3028425
#> 5 1 4 -0.28796224 -1.2222325 -0.3807219
#> 6 1 5 0.01622801 -1.2362032 -1.0056038
plot(sim)
Model Fitting
The FitDTVARIDMx
function fits a DT-VAR model on each
individual
.
library(fitDTVARMx)
fit <- FitDTVARIDMx(
data = data,
observed = paste0("y", seq_len(k)),
id = "id",
ncores = parallel::detectCores()
)
fit
#>
#> Means of the estimated paramaters per individual.
#> beta_11 beta_21 beta_31 beta_12 beta_22 beta_32
#> 0.689924482 0.486092103 -0.108580945 0.006642059 0.621491876 0.415330722
#> beta_13 beta_23 beta_33 psi_11 psi_22 psi_33
#> 0.003199905 -0.015371495 0.499091854 0.098606259 0.099934823 0.099431124
Multivariate Meta-Analysis
The MetaVARMx
function performs multivariate
meta-analysis using the estimated parameters and the corresponding
sampling variance-covariance matrix for each individual
.
Estimates with the prefix b0
correspond to the estimates of
beta
.
library(metaVAR)
meta <- MetaVARMx(
object = fit,
random = FALSE,
ncores = parallel::detectCores()
)
#> Running Model with 9 parameters
#>
#> Beginning initial fit attempt
#> Running Model with 9 parameters
#>
#> Lowest minimum so far: -374.744377237013
#>
#> Solution found
#>
#> Solution found! Final fit=-374.74438 (started at 25874.354) (1 attempt(s): 1 valid, 0 errors)
#> Start values from best fit:
#> 0.694366998609484,0.483106407790532,-0.108385418729956,0.00680176550454613,0.625084647828521,0.410742810401259,0.00183474121440079,-0.016822182670741,0.50097919233646
summary(meta)
#> est se z p 2.5% 97.5%
#> b0_1 0.6944 0.0111 62.3290 0.0000 0.6725 0.7162
#> b0_2 0.4831 0.0113 42.8908 0.0000 0.4610 0.5052
#> b0_3 -0.1084 0.0112 -9.6507 0.0000 -0.1304 -0.0864
#> b0_4 0.0068 0.0092 0.7383 0.4603 -0.0113 0.0249
#> b0_5 0.6251 0.0093 67.2811 0.0000 0.6069 0.6433
#> b0_6 0.4107 0.0093 44.1182 0.0000 0.3925 0.4290
#> b0_7 0.0018 0.0094 0.1950 0.8454 -0.0166 0.0203
#> b0_8 -0.0168 0.0095 -1.7740 0.0761 -0.0354 0.0018
#> b0_9 0.5010 0.0095 52.8912 0.0000 0.4824 0.5195