How can I solve non-conformable arguments in R netmeta::discomb (Error in B.matrix %*% C.matrix)?

33 Views Asked by At

I am trying to perform a network meta-analysis. The network contains 3 subnetworks. Therefore I decided to use netmeta::discomb to perform an additive analysis. This worked without error in another project, but not with the new studies.

My current dataset contains 9 studies over a total of 10 treatments (all two-armed, continuous outcome) . The data was transformed from the arm-based to the contrast-based design using netmeta::pairwise. When calling the method netmeta::discomb, the error appears that the dimensions of the edge-vertex incidence matrices B and C are non-conformable. I guess, the warning about the missing separator will later become a problem.

The help says: By default, the matrix C is calculated internally from treatment names. Passing a C-matrix myself was also unsuccessful. Since the object m1.netmeta is not created, I cannot call C.matrix to recognize a structural error there.

I would like to be able to create a reasonable overview at the end, i.e. with

summary(m1.netmeta), netgraph(m1.netmeta) and forest(m1.netmeta,...).

If required, I can also provide the data and script from the previous project. Maybe it will help. The minimal code used is below. This is session info: R version 4.3.2 (2023-10-31 ucrt) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 10 x64 (build 19045) Matrix products: default

I appreciate any help and will be happy to answer any questions.

library(netmeta)

df <- data.frame(study= c('study 1', 'study 1', 'study 2', 'study 2', 'study 3', 'study 3', 
                         'study 4', 'study 4', 'study 5', 'study 5', 'study 6', 'study 6', 
                         'study 7', 'study 7', 'study 8', 'study 8', 'study 9', 'study 9'),
                 stud_ind= c(1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2),
                 comparators= c(1, 2, 3, 2, 1, 2, 4, 2, 5, 0, 6, 2, 7, 2, 6, 2, 8, 9),
                 n_probands= c(14, 14, 15, 15, 9, 9, 19, 19, 21, 21, 27, 27, 15, 15, 18, 19, 14, 11),
                 mean= c(3.13, 3.47, 2.36, 3.61, 2.89, 2.78, 2.36, 2.36, 2.64, 5.00, 3.24, 
                         3.28, 1.53, 1.53, 3.07, 2.89, 3.00, 3.30),
                 sd= c(2.06, 1.74, 1.99, 1.95, 1.97, 1.29, 1.32, 1.32, 1.68, 
                       2.75, 1.21, 1.17, 1.20, 1.20, 2.23, 2.56, 1.53, 1.52))

# long to wide + contrast based
df_wide = df %>% 
  pivot_wider(names_from=c(stud_ind), values_from=c(comparators, n_probands, mean, sd))
p1 <- pairwise(list(comparators_1, comparators_2),
               TE = list(mean_1, mean_2), seTE = list(sd_1, sd_2),
               data = df_wide, sm = "MD", reference.group = "2")

# look at network
nc1 <- netconnection(
  data=p1,
  sep.trts = ":",
  nchar.trts = 500,
  title = "",
  warn = FALSE,
)
print(nc1)


################################# 
m1.netmeta <- discomb(TE = TE,
                      seTE = seTE,
                      treat1= treat1,
                      treat2= treat2,
                      studlab = study,
                      data = p1,
                      sm = "MD",
                      fixed = FALSE,
                      random = TRUE,
                      reference.group = "2",
                      details.chkmultiarm = FALSE,
                      sep.trts = " vs. ")
# results in error:
# Error in B.matrix %*% C.matrix : non-conformable arguments
# In addition: Warning message:
#  No treatment contains the component separator '+'. 

################################# 
# try with 'own' C.matrix
C <- rbind(c(1, 0, 0, 0, 0, 0, 0, 0, 0),  # 0
           c(0, 1, 0, 0, 0, 0, 0, 0, 0),  # 1
           c(0, 0, 1, 0, 0, 0, 0, 0, 0),  # 2
           c(0, 0, 0, 1, 0, 0, 0, 0, 0),  # 3
           c(0, 0, 0, 0, 1, 0, 0, 0, 0),  # 4
           c(0, 0, 0, 0, 0, 1, 0, 0, 0),  # 5
           c(0, 0, 0, 0, 0, 0, 1, 0, 0),  # 6
           c(0, 0, 0, 0, 0, 0, 0, 1, 0),  # 8
           c(0, 0, 0, 0, 0, 0, 0, 0, 1))  # 9
colnames(C)<-c("0","1","2","3","4","5","6","8","9")    
rownames(C)<-c("0","1","2","3","4","5","6","8","9") 

m2.netmeta <- discomb(TE = TE,
                      seTE = seTE,
                      treat1= treat1,
                      treat2= treat2,
                      studlab = study,
                      data = p1,
                      sm = "MD",
                      fixed = FALSE,
                      random = TRUE,
                      reference.group = "2",
                      details.chkmultiarm = FALSE,
                      sep.trts = " vs. ",
                      C.matrix = C)
# results in error:
# Error in B.matrix %*% C.matrix : non-conformable arguments
# In addition: Warning message:
#  No treatment contains the component separator '+'. 
0

There are 0 best solutions below