Error When Running Arm-Based Network Meta-Analysis for Binary Outcomes: A Practical Guide to Understanding and Overcoming Limitations in R's pcnetmeta Package

Error when Running Arm-Based Network Meta-Analysis for Binary Outcomes

Introduction to Network Meta-Analysis

Network meta-analysis (NMA) is a statistical method used to compare the efficacy of different treatments or interventions. In the context of binary outcomes, such as treatment response in clinical trials, NMA can help determine which treatment is most effective compared to others. This method has gained significant attention in recent years due to its ability to synthesize evidence from multiple studies and provide a comprehensive view of treatment effects.

Overview of pcnetmeta Package

The pcnetmeta package is an R implementation of network meta-analysis, specifically designed for binary outcomes. It provides a user-friendly interface for performing NMA, including the nma.ab.bin function, which is used to estimate the effects of treatments on binary outcomes.

Running nma.ab.bin Function

To perform arm-based NMA using the pcnetmeta package, one must use the nma.ab.bin function. This function takes in various inputs, including study data, treatment names, and model parameters.

nma.out <- nma.ab.bin(
  s.id = study IDs,
  t.id = treatment IDs,
  r = number of events,
  n = patient enrollment,
  data = study data,
  trtname = treatment names,
  param = "AR", # prior distribution for AR effect
  model = "het_cor", # correlation structure for random effects
  n.adapt = 400, # adaptive sampling for better convergence
  n.iter = 100, # number of iterations for Markov Chain Monte Carlo (MCMC)
  n.chains = 1 # number of MCMC chains
)

Error Message Analysis

Unfortunately, the error message provided by the pcnetmeta package is not informative. To understand the underlying problem, one must examine the JAGS code used by the nma.ab.bin function.

T[1:ntrt,1:ntrt]~dwish(I[1:ntrt,1:ntrt], ntrt+1)

This line of code uses the Wishart distribution (dwish) to model the variance-covariance matrix of random effects. The ntrt variable represents the number of treatment arms in the study data.

Solution

The error message indicates a problem with the Wishart distribution, specifically due to the value of ntrt. In this case, ntrt is equal to 1, which is not sufficient for the Wishart distribution. To make the code work, ntrt must be greater than 1.

Practical Implications

The requirement that ntrt be greater than 1 has practical implications for using the nma.ab.bin function. In order to perform arm-based NMA, one must have at least two treatment arms in their study data.

Conclusion

Network meta-analysis is a valuable tool for comparing the efficacy of different treatments or interventions. However, it requires careful consideration of its assumptions and limitations. The pcnetmeta package provides a user-friendly interface for performing arm-based NMA using JAGS program as backend. By understanding the underlying JAGS code and potential pitfalls, users can effectively utilize this package to synthesize evidence from multiple studies.

Example Use Case

Here’s an example use case of the nma.ab.bin function:

# Load necessary libraries
library(pcpnetmeta)

# Create study data
s.id = c(1, 2, 3) # study IDs
t.id = c("Treatment A", "Treatment B") # treatment names
r = c(10, 20, 30) # number of events
n = c(100, 200, 300) # patient enrollment

# Define model parameters
param = list(
  AR = rmean(c(0.5, 1.2)), # prior distribution for AR effect
  sigma = rlog(c(1, 2)) # prior distribution for random effects variance
)

# Run nma.ab.bin function
nma.out <- nma.ab.bin(
  s.id = s.id,
  t.id = t.id,
  r = r,
  n = n,
  data = cbind(r, n),
  trtname = t.id,
  param = param,
  model = "het_cor", # correlation structure for random effects
  n.adapt = 400, # adaptive sampling for better convergence
  n.iter = 100, # number of iterations for Markov Chain Monte Carlo (MCMC)
  n.chains = 1 # number of MCMC chains
)

# Print results
print(nma.out)

This example demonstrates how to use the nma.ab.bin function with a simple study data set. It also highlights the importance of considering the assumptions and limitations of NMA when performing this type of analysis.


Last modified on 2023-11-15