guido-s / netmeta

Official Git repository of R package netmeta
http://cran.r-project.org/web/packages/netmeta/index.html
GNU General Public License v2.0
28 stars 12 forks source link

how to get heterogeneity indexes from NMA with survival outcomes? #15

Closed fedenichetti closed 1 year ago

fedenichetti commented 1 year ago

Dear netmeta friends, I am trying to perform a NMA on clinical trial data that have survival outcomes (in detail, hazard ratios) as treatment effect size.

I successfully used the metagen function to obtain TE and seTE, so my data look as follows (the study names and arms are fictional here)

test <- tibble::tribble(
  ~study,  ~hr, ~low_ci, ~high_ci,                 ~treat1,      ~treat2, ~endpoint,         ~TE,      ~seTE,
  "a", 0.83,     0.7,     0.99,             "d",   "x",      "OS", -0.18632958, 0.08842627,
  "b", 1.39,    1.21,     1.61,                   "a",   "x",      "OS",  0.32930375, 0.07286201,
  "c", 0.95,    0.77,     1.18, "b", "v",      "OS", -0.05129329, 0.10889976,
  "d", 1.07,    0.93,     1.23,  "c",   "x",      "OS",  0.06765865, 0.07132398,
  "e", 1.01,     0.8,     1.27,      "d",   "x",      "OS", 0.009950331, 0.11790024,
  "f", 1.11,     0.9,     1.36,    "e",   "x",      "OS", 0.104360015, 0.10531959,
  "g", 1.75,    1.37,     2.22,                   "a", "v",      "OS", 0.559615788, 0.12313911
)

However, as I run

m.netmeta <- netmeta(TE = TE,
                     seTE = seTE,
                     treat1 = treat1,
                     treat2 = treat2,
                     studlab = study,
                     data = test,
                     sm = "HR",
                     fixed = F,
                     random = T,common = F, 
                     reference.group = "x",
                     details.chkmultiarm = F,
                     sep.trts = " vs ")

everything works but I cannot get an estimate of heterogeneity. In detail, I get:

Quantifying heterogeneity / inconsistency: tau^2 = NA; tau = NA

Tests of heterogeneity (within designs) and inconsistency (between designs): Q d.f. p-value Total 0 0 -- Within designs 0 0 -- Between designs 0 0 --

Is this due to a bug, me putting the data in the wrong format, or in the type of data itself? I am using: R version 4.2.2 (2022-10-31) netmeta_2.8-2 meta_6.5-0

Thanks, Fede

guido-s commented 1 year ago

Fede,

You should only get tau2 = NA if there is neither within-designs heterogeneity (i.e., only one comparison per design) nor between-designs inconsistency (i.e., no loops in the network). I checked this using the command

netgraph(m.netmeta, plastic = FALSE, iterate = TRUE, cex.points = 7, adj = 0.5, number = TRUE, col = "black")
netgraph

Obviously, there are no loops (no measurable inconsistency), however, two comparisons exist for 'd' vs 'x'. Accordingly, there is some within-designs heterogeneity which should result in an estimate of tau2.

And actually, I get an estimate of tau2 using the command

m.netmeta <-
  netmeta(TE, seTE, treat1, treat2, study, data = test,
          sm = "HR", common = FALSE, 
          reference.group = "x", sep.trts = " vs ")
#
m.netmeta

Number of studies: k = 7
Number of pairwise comparisons: m = 7
Number of treatments: n = 7
Number of designs: d = 6
...
Quantifying heterogeneity / inconsistency:
tau^2 = 0.0084; tau = 0.0917; I^2 = 43.6%

Tests of heterogeneity (within designs) and inconsistency (between designs):
                   Q d.f. p-value
Total           1.77    1  0.1829
Within designs  1.77    1  0.1829
Between designs 0.00    0      --

This estimate of tau2 is identical to the tau2 from the pairwise comparison 'd' vs 'x'.

metagen(TE, seTE, data = test, subset = treat1 == "d", method.tau = "DL")

Number of studies: k = 2
...
Quantifying heterogeneity:
 tau^2 = 0.0084; tau = 0.0917; I^2 = 43.6%; H = 1.33

Test of heterogeneity:
    Q d.f. p-value
 1.77    1  0.1829

So, I cannot explain why you should get tau2 = NA.

fedenichetti commented 1 year ago

Dear Guido, thanks for your swift reply! I probably misspelled the data. Here is my correct dataset:

test <- tibble::tribble(
         ~study,  ~hr, ~low_ci, ~high_ci,                 ~treat1,      ~treat2, ~endpoint,         ~TE,      ~seTE,
     "trial1", 0.83,     0.7,     0.99,             "z",   "x",      "OS", -0.18632958, 0.08842627,
        "trial2", 1.39,    1.21,     1.61,                   "g",   "x",      "OS",  0.32930375, 0.07286201,
   "trial3", 0.95,    0.77,     1.18, "a", "y",      "OS", -0.05129329, 0.10889976,
  "trial4", 1.07,    0.93,     1.23,  "b",   "x",      "OS",  0.06765865, 0.07132398,
         "trial5", 1.01,     0.8,     1.27,      "c",   "x",      "OS", 0.009950331, 0.11790024,
      "trial6", 1.11,     0.9,     1.36,    "d",   "x",      "OS", 0.104360015, 0.10531959,
     "trial7", 1.75,    1.37,     2.22,                   "g", "y",      "OS", 0.559615788, 0.12313911
  )

With this, I get tau2 = NA. I guess, based on your reply, that it is because "there is neither within-designs heterogeneity (i.e., only one comparison per design) nor between-designs inconsistency (i.e., no loops in the network)". If this is correct, I would report this as a result of my analysis. Correct? Thanks! Fede

guido-s commented 1 year ago

Yes, indeed. See the network graph.

netgraph(m.netmeta, plastic = FALSE, iterate = TRUE, cex.points = 7, adj = 0.5, number = TRUE, col = "black")
netgraph2