[R-meta] inner-outer-grouping-factor-structure for multiple treatment studies

Viechtbauer Wolfgang (SP) wolfgang.viechtbauer at maastrichtuniversity.nl
Mon Sep 4 16:25:00 CEST 2017

I am not quite sure why you switched to the standardized mean difference as the outcome measure if your original plan was to use the (log) ratio of means. Switching just because I happen to give some illustrative code for the SMD (instead of ROM) on the metafor website is not really a good reason for such a decision IMHO.

In the end, this is purely a programming issue now. As I mentioned, your dataset is a bit more complex, since in your case, it isn't always the first (or second) group whose data is being reused, but sometimes the first, sometimes the second. So the code that I give on the metafor website isn't going to work for you anyway without some further adjustments.

Again, for ROM, the covariance is simply:


from the group whose data is being re-used. escalc() already gives you the variances, which go on the diagonal of the V matrix. So, you just need to find a way to fill in the off-diagonal elements of V using the formula above. You could even get this done with something like:

ma.grass <- escalc(m1 = forest_mean, m2 = ref_mean, sd1 = forest_sd, sd2 = ref_sd,
                   n1 = forest_N, n2 = ref_N, measure = "ROM", slab = article)

V <- diag(ma.grass$vi)

And let's say the first and second row are data from a multi-treatment study with 2 treatment groups and 1 control group, where 'ref' corresponds to the control group (so ref_mean/sd/N[1] and ref_mean/sd/N[2] are actually the same data). Then:

V[1,2] <- V[2,1] <- ref_sd[1]^2 / (ref_N[1] * ref_mean[1]^2)

will fill in the covariance of the first and second row into the V matrix.

Now proceed in the same way for other studies. If the data from the 'forest' group are being reused, then use:

V[row,column] <- V[column,row] <- forest_sd[row]^2 / (forest_N[row] * forest_mean[row]^2)

This isn't elegant and 'hard coded' but it gets the job done.


-----Original Message-----
From: Vivien Bonnesoeur [mailto:bonnesoeur.vivien at gmail.com] 
Sent: Friday, 01 September, 2017 16:41
To: Michael Dewey
Cc: Viechtbauer Wolfgang (SP); r-sig-meta-analysis at r-project.org
Subject: Re: [R-meta] inner-outer-grouping-factor-structure for multiple treatment studies

Oh yes, It looked clear when I sent it but it is unreadable now. It should be clearer this time

After Wolfgang advices, I've been changing the way I'm computing the effect size and I have been using the standardised mean difference instead of the log ratio of the mean
to be able to use the code from "gleser 2009".  In this code, the
covariance in the covariance matrix is calculated as:

matrix(1/x$ref_mean[1] + outer(x$yi, x$yi, "*")/(2*x$Ntot[1]), nrow=nrow(x), ncol=nrow(x))

where n2i is the control group reused. I used this code because N was equal
for the treatment and reference group. There is only the study from Rhoade
where I'm not sure of the application of this formula because in this case
the treatment and the reference are reused once.
I was able to get the variance-covariance V matrix and fit the model:

metamodel3 <-rma.mv (yi, V, mods = ~ Land_use_change - 1, random = ~ factor(id) | article, rho=1/2, data=ma.grass[k,])
but it did not work and I get the error message :

Error in .ll.rma.mv(opt.res$par, reml = reml, Y = Y, M = V, A = A, X.fit = X,  : 
  Final variance-covariance matrix not positive definite.
De plus : Warning message:
In rma.mv(yi, V[k, k], mods = ~Luchange - 1, random = ~factor(trial) |  :
  'V' appears to be not positive definite.

after some tests restricting the matrix to individual studies, it appears that the sub-matrix from the study Farle is not positive definite.
Could you give a little more help to solve this problem and to confirm that the code I used was appropriate?
I would like not dropping this study which is quite important in the meta-analysis.

Thanks in advance

More information about the R-sig-meta-analysis mailing list