Reputation: 23
Im trying to conduct a NMA using the R package gemtc. I have three comparisons: A v D: MD: 119 (17.6) B v D: MD: 73 (23.98) C v D: MD: 92 (21.94)
I am following an example code which appear to be functional:
library(gemtc)
library(rjags)
library(dmetar)
data(TherapyFormatsGeMTC)
head(TherapyFormatsGeMTC$data)
TherapyFormatsGeMTC$treat.codes
network <- mtc.network(data.re = TherapyFormatsGeMTC$data,
treatments = TherapyFormatsGeMTC$treat.codes)
model <- mtc.model(network,
likelihood = "normal",
link = "identity",
linearModel = "random",
n.chain = 4)
however when i try and use my code:
library(gemtc)
library(rjags)
library(dmetar)
treatments <- read.table(textConnection('
id description
A "Treatment A"
B "Treatment B"
C "Treatment C"
D "Treatment D"'), header=TRUE)
data <- read.table(textConnection('
study diff std.err treatment
"Study A" 119 17.60 A
"Study A" NA NA D
"Study B" 73 23.98 B
"Study B" NA NA D
"Study C" 92 21.94 C
"Study C" NA NA D'), header=TRUE)
data$diff<-as.numeric(data$diff)
network1 <- mtc.network(data, description="Example", treatments=treatments)
model <- mtc.model(network1,
likelihood = "normal",
link = "identity",
linearModel = "random",
n.chain = 4)
I get the following error:
Error in validate.data.normal.identity(list(study = c(1L, 1L, 2L, 2L, :
all(data.ab[["std.err"]] > 0) is not TRUE
and I cant work out what I am doing wrong
Upvotes: 0
Views: 628
Reputation: 11
there.
The first argument of mtc.network
is data.ab
, which means data for arms other than relative data, whereas the data in both data mentioned are relative data. Thus, it might be helpful if the data can be passed as data.re
rather than data.ab
like the following code.
network1 <- mtc.network(data.re = data, description="Example", treatments=treatments)
Upvotes: 1