# [R-meta] Covariance-variance matrix when studies share multiple treatment x control comparison

Ju Lee juhyung2 @end|ng |rom @t@n|ord@edu
Wed Sep 18 19:43:36 CEST 2019

```Dear Wolfgang and all,

I am running a multivariate mixed effect models using rma.mv and trying to build a variance-covariance matrix to account for inter-dependence rising from shared experimental units.

The issue I have is: what if my analysis includes studies where both controls and treatment groups are repeatedly used to calculate effect sizes (this was because each comparison produces different categorical comparison that are meaningful, but I am also trying to pool all studies to calculate the grand mean effect sizes ).

If I simplify my dataframe, it looks like below. here m1i, m2i are means for treatment and controls and n1i and n2i are sample sizes needed for constructing cov-var matrix.

study   treatment       m1i     m2i     n1i     n2i
1       1       7.87    -1.36   25      25
1       2       4.35    -1.36   22      25

1       2       4.35    7.87    22      25

2       1       9.32    0.98    38      40

3       1       8.08    1.17    50      50

4       1       7.44    0.45    30      30

4       2       5.34    0.45    30      30

If you look at study 1, all three effect sizes share different subset of experimental group. Based on Wolfgang's code, I am trying to construct Cov-var matrix using following code:

calc.v <- function(x) {
v <- matrix(1/x\$n2i + outer(x\$yi, x\$yi, "*")/(2*x\$Ni), nrow=nrow(x), ncol=nrow(x))
diag(v) <- x\$vi
v
}
V <- bldiag(lapply(split(dat, dat\$study), calc.v))
V

But I am not sure how I can proceed here because all three effect sizes should be interdependent due to sharing some experimental groups, but how can we specify this in the matrix? Especially, between first and third response in the first study, mean of 7.87 is treatment in the first but control in the third response. How can we reasonably account for inter-dependence in such a case?

Thank you very much,
Best,
JU

[[alternative HTML version deleted]]

```