2
$\begingroup$

I would like to perform a meta-analysis on data gathered from multiple studies. Assume that the data contains multiple correlated outcomes of interest, but that not all studies have the outcome in question. For example, such a dataset could be generated as follows (note that I have simplified the model to keep the code brief):

set.seed(8)

# get simulated effect size and variance of outcome
get.df <- function(z, x, u)
{
  v <- apply(x, 2, var)
  d <- (colMeans(x) - u)/v
  return(data.frame(study = 1:ncol(x), outcome = z, d = d, v = v))
}

# simulate multiple experiments with correlated outcomes
f <- function(n, u)
{
  x1 <- replicate(n, rnorm(100, mean = u + 1, sd = 0.75))
  x2 <- 0.1 - x1[, 1:(n - 2)] # negatively correlated
  x3 <- x1[, 1:(n - 1)] * 1.3 # positively correlated
  res <- mapply(get.df, z = LETTERS[1:3], x = list(x1, x2, x3), u = u, SIMPLIFY = FALSE)
  return(rbind(res$A, res$B, res$C))
}

res <- f(5, 2)

> res
   study outcome          d         v
1      1       A   1.421154 0.6544090
2      2       A   1.552706 0.6423655
3      3       A   2.277247 0.3931349
4      4       A   1.433224 0.6815152
5      5       A   1.587405 0.5972025
6      1       B  -7.380729 0.6544090
7      2       B  -7.624016 0.6423655
8      3       B -12.197506 0.3931349
9      1       C   1.635715 1.1059512
10     2       C   1.747080 1.0855977
11     3       C   2.654802 0.6643979
12     4       C   1.623422 1.1517607

It is not clear to me how I can set up the metafor package to perform an analysis of such a dataset.

$\endgroup$
4
$\begingroup$

It depends on what kind of model you actually want to fit. But let's assume you want a model that allows for different average true effects and different amounts of heterogeneity for each outcome. In addition, the underlying true effects for the different outcomes are likely to be correlated, so we also want to allow for that.

Such a model can be fitted with:

rma.mv(d, v, mods = ~ outcome - 1, random = ~ outcome | study, struct="UN", data=res)

Your way of generating a toy dataset is a bit peculiar, because it essentially assumes that the true correlation between the three outcomes is either 1 (for A and C) or -1 (for A and B and for B and C). So you won't get anything really sensible here with such a model, but real data should not behave this way.

You may also want to read this question (and my answer provided there). In a multivariate meta-analysis, you typically also need to account for the correlation in the sampling errors (in fact, your way of generating the raw data implies that the sampling errors are perfectly correlated). So this is all a bit of a mess here, but I assume this toy dataset is just for illustration purposes and has nothing to do with your actual data.

$\endgroup$
  • $\begingroup$ You are of course right with respect to the synthetic data I created. Fantastic summary and great answers. Thanks a lot for the metafor package! $\endgroup$ – ruser45381 Sep 30 '15 at 13:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.