You are here

Imposing constraints on the between-studies covariance matrix

4 posts / 0 new
Last post
forscher's picture
Joined: 03/05/2013 - 09:31
Imposing constraints on the between-studies covariance matrix

Hi metaSEM users,

I'm currently trying to use metaSEM to implement a network meta-analysis (i.e., a meta-analysis of different treatment comparisons; see Salanti, 2012). One important aspect of multivariate implementations of network meta-analysis is that the between-studies takes on a particular structure (see Lu & Ades, 2004). For example, given AB, AC, and AD, one common way to constrain the matrix is to do the following (basically, set the correlation between any two treatment comparisons equal to .5):

       AB            AC              AD

AB s1^2 .5s1s2 .5s1s3
AC .5s1s2 s2^2 .5s3s3
AD .5s1s3 .5s2s3 s3^2

It looks like the way to impose this structure is through the RE.constraints argument. However, I'm a little in the dark about how to force the covariances to essentially be a function of the variances. Can anyone help me?

Code sample pasted below for reference.

Begin example

AB <- c(.5, .3, .2, .2, NA, NA, .1)
AC <- c(NA, .3, .4, NA, .2, .1, .5)
ys <- data.frame(AB, AC)

n1 <- 50
n2 <- 50
nT <- 150 # Assuming equal N per study arm; N = 50

vars <- matrix(c(1/n1 + 1/n2 + .5^2/(2(n1 + n2)), NA, NA,
1/n1 + 1/n2 + .3^2/(2
nT), 1/n1 + .3 * .3 / (2nT), 1/n1 + 1/n2 + .3^2/(2nT),
1/n1 + 1/n2 + .2^2/(2nT), 1/n1 + .2 * .4 / (2nT), 1/n1 + 1/n2 + .4^2/(2nT),
1/n1 + 1/n2 + .2^2/(2
(n1 + n2)), NA, NA,
NA, NA, 1/n1 + 1/n2 + .2^2/(2(n1 + n2)),
NA, NA, 1/n1 + 1/n2 + .1^2/(2
(n1 + n2)),
1/n1 + 1/n2 + .1^2/(2nT), 1/n1 + .1 * .5 / (2nT), 1/n1 + 1/n2 + .5^2/(2*nT)),
nrow = 7, ncol = 3, byrow = T)

con <- matrix(0, ncol = 2, nrow = 2)
diag(con) <- "2*a"

What to do with the covariances?

mod <- meta(y = ys, v = vars, RE.constraints = con)

Mike Cheung's picture
Joined: 10/08/2009 - 22:37
The current version of

The current version of metaSEM (0.8-2) is not flexible enough to handle the covariance structure list above. I will try to implement it in the future releases. For the time being, you may need to code it directly in OpenMx.

Multivariate meta-analysis can be formulated as a SEM, see Figure 5 in the following paper.

Suppose the the known sampling variance covariance matrix is V, R is the correlation matrix of the random effects, and SD is the diagonal matrix of the standard deviations of the random effects, the model implied covariance matrix is
SD %&% R + V
In your case, R is a known correlation matrix of .5.

Hope it helps.


forscher's picture
Joined: 03/05/2013 - 09:31
Some sample code

Mike, thanks so much for replying. I've read through the paper that you linked to, which was also very helpful.

Per your suggestion, I've attempted to fit a relatively simple network meta-analysis model using OpenMx (and a few functions from your metaSEM package). It's been a little tough for me to figure out exactly the proper steps, so I proceeded by trying to reverse-engineer the code from your meta() function (I hope you don't mind).

I've fit a relatively simple model using some data that I fabricated. The data consist of studies comparing three conditions, A, B, and C. For simplicity, I'm assuming that only AB and BC comparisons are observed (there are procedures for representing AC comparisons, but I'd rather make sure that I'm imposing my desired constraints before I tackle that part of the code). I am attempting to fit a model that estimates two intercepts, one representing the estimated AB effect size and another representing the estimated BC effect size. I am attempting to impose the constraint that the between-studies correlation between the AB and BC effect sizes is .5, and I'm attempting to allow separate estimates of the variance for AB and BC.

I wonder if I might impose upon you to glance through my code to make sure that I have successfully implemented my desired constraints. I'm only moderately familiar with OpenMx (and with the SEM approach to multivariate meta-analysis in general), so I'm feeling paranoid that I may have made a mistake somewhere. My code is attached. I've made copious comments to myself about what each line is doing to make sure that I understand what's going on in the code.

Mike Cheung's picture
Joined: 10/08/2009 - 22:37
I have never conducted a

I have never conducted a network meta-analysis before. From the code, it appears to be correct.

One (minor) issue is the estimates of the sd which are negative. Since they are squared in calculating the variance covariance matrix, it may not be a critical issue.

Log in or register to post comments