gertvv / gemtc

GeMTC R package: model generation for network meta-analysis

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Bug] Node-splitting models broken?

riher opened this issue · comments

Hey, first of all, thank you so much for this amazing package, you're doing god's work!

One problem I've stumbled upon though, not being able to resolve it:
I can't create a node-splitting model. The error message I'm getting:

9.
FUN(X[[i]], ...)
8.
lapply(X = X, FUN = FUN, ...)
7.
sapply(data[, "study"], function(study) { sum(data[, "study"] == study) > 1 })
6.
remove.onearm(data.re, warn = TRUE)
5.
mtc.network(data.ab = data.ab, data.re = data.re, treatments = model[["network"]][["treatments"]], studies = studies)
4.
mtc.model.nodesplit(list(type = "nodesplit", linearModel = "random", network = structure(list(description = "Network", treatments = structure(list( id = structure(1:23, .Label = c(...
3.
do.call(fn, c(list(model), list(...)))
2.
mtc.model.call("mtc.model", model, ...)
1.
mtc.model(nma$network, linearModel = "random", n.chain = 3, likelihood = "normal", link = "identity", type = "nodesplit", t1 = "...", t2 = "...")

Version 0.8-7 of gemtc.
Version 1.3.959 of RStudio
Version 4.0.2 of R

I'd be very grateful for any pointers on how to get this to run.

Cheers

I looked into it a bit more. It seems to be caused by the data (data.re) being passed as a tibble, not as a data frame.

As tidyverse is common and this is pretty obscure, applying as.data.frame somewhere to the data would be quite helpful.

// Since this is a bug in mtc.network(), I'm wondering why it only appears when trying to fit a node-splitting model, while calling mtc.network() on its own works fine...

A similar error occurred with mtc.anohe. It's also fixed by this change.

Hi Ricardo. Thanks for reporting and looking into this. The pull request is also much appreciated, I'll leave some feedback there.

I have also found one more problem with node-splitting model (gemtc v. 0.8-7; R v. 4.0.2).
It occurs with the code which worked with absolutely no problem before.

gemtc_data - a tibble with study, treatment, responders, and sampleSize columns.

mynetwork <- mtc.network(data.ab = as.data.frame(gemtc_data), description = "Data1")
nodespl <- mtc.nodesplit(mynetwork, linearModel = .x, n.adapt = 20000, n.iter = 180000, n.chain = 3, thin = 3)
res <- summary(nodespl)$p.value %>% as_tibble()

There are several following warnings after both fixed and random models:

# rjags::jags.model(file.model, data = syntax[["data"]], inits = syntax[["inits"]],  :
#  Unused variable "om.scale" in data

Thanks, both issues have been fixed for the upcoming version.