# \donttest{
# Transform data from long arm-based to contrast-based format
#
pw <- pairwise(studlab = study, treat = treatment,
n = n, mean = mean, sd = sd, data = Senn2013,
varnames = c("MD", "seMD"))
nc1 <- netconnection(pw)
nc1
# Extract number of (sub)networks
#
nc1$n.subnets
# Extract distance matrix
#
nc1$D.matrix
# Artificial example with two subnetworks
#
t1 <- c("G", "B", "B", "D", "A", "F")
t2 <- c("B", "C", "E", "E", "H", "A")
#
nc2 <- netconnection(t1, t2)
print(nc2, details = TRUE)
# Number of subnetworks
#
nc2$n.subnets
# Extract distance matrix
#
nc2$D.matrix
# Conduct network meta-analysis (results in an error message due to
# unconnected network)
try(nma <- netmeta(1:6, 1:6, t1, t2, 1:6))
# Conduct network meta-analysis on first subnetwork
#
nma.1 <- netmeta(1:6, 1:6, t1, t2, 1:6, subset = nc2$subnet == 1)
# Conduct network meta-analysis on second subnetwork
#
nma.2 <- netmeta(1:6, 1:6, t1, t2, 1:6, subset = nc2$subnet == 2)
nma.1
nma.2
# }
Run the code above in your browser using DataLab