[R-meta] subgroup analysis using metabind

Eleanor Birch E|e@nor@B|rch @end|ng |rom ed@@c@uk
Wed Sep 25 17:17:47 CEST 2024


Hi

I've been using the meta package to do some subgroup analysis, and have come up with a few questions I hope someone can help me with. I am relatively new to using R, and this is my first foray into metaanalysis, so please excuse me if these have obvious answers, I have tried search on the mailing list with no obvious answer I could understand.

The code I have written performs two sub group analyses using metacor, then combines them using metabind and draws a forest plot of them. I have attached the simplified code, data, and metabind summary below, and attached the forest plot generated (with quite a bit of styling coding removed for simplicity).

My questions are:
1. I have included the test for effect in subgroup (test.effect.subgroup.random = TRUE). however, having read through the documentation about the package I am still not totally clear what this is testing. I think the null hypothesis is something like 'there is no different in effect between groupings within the subgroup'. could anyone confirm if this is roughly correct?

2. The I2 and Tau2 values in the metabind summary and forest plot are very different (99% and 0%, and 4.9963 and 0.0683, respectively). Is this correct? Am I doing something wrong? I don't have the same issue if I create a forest plot from a metacor object of the data.

3. I wanted to add the p-value for each row as a column. I tried adding it as a column on either side (leftcols = c('studlab','k', 'pval') or rightcols = c('pval', 'TE', 'ci')), both of which gives me the error "Error in x$labels[[i]] : subscript out of bounds".
I tried some problem solving: If i try added another item from the same metabind object (for example, 'statistic') in the same way, the forest plot is created with no problem. I called the data from pval outwith the forestplot (print(m.bind.sub$pval)) and it was printed no problem. I experimented with calling the data in a different way (leftcols = c('studlab','k', m.bind.sub$pval)) and got a different error "Error: Variable '0.550785867814187' not available in meta-analysis object.". I also tried rounding the p-values down (leftcols = c('studlab','k', (format(round(m.bind.sub$pval, 3), nsmall = 3)))) and got nearly the same error "Error: Variable '0.551' not available in meta-analysis object.".
Any advice to be able to add this column? It seems to be something of an issue with this data specifically, rather than the whole metabind object.

thank you for any and all advice
Eleanor Birch

Code and data:
#install library packagages
library(tidyverse)
library(meta)

#simplified data
res.all <- data.frame(paper = c("A", "A", "B", "C", "D", "D"), peat_type = c("bog","fen","fen","bog","bog","fen"), depth = c("<10", "21-30","21-30","<10", "11-20","11-20"), n = c(90,45,20,16,120,120), r = c(-0.556525043,0.748497322,0.526751218,0.99994506,-0.443646523,-0.520320445))

#meta analysis using a random effects model - peat type subgroup analysis
m.cor.typ <- metacor(data = res.all,
                 cor = r,
                 n = n,
                 studlab = paper,
                 fixed = FALSE,
                 random = TRUE,
                 method.tau = "REML",
                 method.random.ci = "HK",
                 keepdata = TRUE,
                 subgroup = peat_type,
                 tau.common = FALSE
                 )

#meta analysis using a random effects model - sample depth subgroup analysis
m.cor.dep <- metacor(data = res.all,
                 cor = r,
                 n = n,
                 studlab = paper,
                 fixed = FALSE,
                 random = TRUE,
                 method.tau = "REML",
                 method.random.ci = "HK",
                 keepdata = TRUE,
                 subgroup = depth,
                 tau.common = FALSE
                 )

# combining metaanalyses for different subgroups
m.bind.sub <- metabind(m.cor.typ, m.cor.dep,
                       name = c ("Peatland type", "Sample depth"),
                      random = TRUE)

summary(m.bind.sub)

# create forest plot for subgroup analysis
forest(m.bind.sub,
       random = TRUE, # use random effects model
       leftcols = c('studlab','k'),
       #rightcols = c('pval', 'TE', 'ci'),
       #leftcols = c('studlab','k', 'pval'),
       test.overall.random = TRUE, #include p-value test for overall summary
       test.effect.subgroup.random = TRUE, #include test for effect in subgroup using random model
       backtransf = TRUE
       )

metabind results summary:

          COR            95%-CI meta-analysis
bog    0.8797 [-1.0000; 1.0000] Peatland type
fen    0.3047 [-0.9362; 0.9814] Peatland type
<10    0.9803 [-1.0000; 1.0000]  Sample depth
21-30  0.6768 [-0.9131; 0.9966]  Sample depth
11-20 -0.4829 [-0.8218; 0.1082]  Sample depth

Number of studies: k = 6
                        COR            95%-CI    t p-value
Random effects model 0.6883 [-0.9079; 0.9967] 0.92  0.3997

Quantifying heterogeneity:
 tau^2 = 4.9963; tau = 2.2352; I^2 = 99.0% [98.6%; 99.3%]; H = 9.95 [8.49; 11.65]

Test of heterogeneity:
      Q d.f.  p-value
 494.75    5 < 0.0001

Results for meta-analyses (random effects model):
                k    COR            95%-CI  tau^2    tau      Q   I^2
Peatland type   6 0.6883 [-0.9079; 0.9967] 4.9963 2.2352 494.75 99.0%
Sample depth    6 0.6883 [-0.9079; 0.9967] 4.9963 2.2352 494.75 99.0%

Details on meta-analytical method:
- Inverse variance method
- Restricted maximum-likelihood estimator for tau^2
- Hartung-Knapp adjustment for random effects model (df = 5)
- Fisher's z transformation of correlations
The University of Edinburgh is a charitable body, registered in Scotland, with registration number SC005336. Is e buidheann carthannais a th’ ann an Oilthigh Dhùn Èideann, clàraichte an Alba, àireamh clàraidh SC005336.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: subgroup metabind forestplot.jpg
Type: image/jpeg
Size: 63954 bytes
Desc: subgroup metabind forestplot.jpg
URL: <https://stat.ethz.ch/pipermail/r-sig-meta-analysis/attachments/20240925/18c0fd04/attachment-0001.jpg>


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