Learn R Programming

netmeta (version 0.7-0)

pairwise: Transform meta-analysis data from arm-based format into contrast-based format

Description

This function transforms data that are given in an arm-based format (e.g. input for WinBUGS is of this format) to a contrast-based format that is needed as input to R function netmeta. The function can transform data with binary, continuous, or generic outcomes as well as incidence rates from arm-based to contrast-based format.

Usage

pairwise(treat, event, n, mean, sd, TE, seTE, time,
         data=NULL, studlab, ...)

Arguments

treat
A list with treatment information for individual treatment arms.
event
A list with information on number of events for individual treatment arms.
n
A list with information on number of observations for individual treatment arms.
mean
A list with estimated means for individual treatment arms.
sd
A list with information on the standard deviation for individual treatment arms.
TE
A list with estimated treatment effects for individual treatment arms.
seTE
A list with standard errors of estimated treatment effect for individual treatment arms.
time
A list with information on person time at risk for individual treatment arms.
data
An optional data frame containing the study information.
studlab
A vector with study labels (optional).
...
Additional arguments passed-through to the functions to calculate effects.

Value

  • A data frame with the following columns
  • TETreatment estimate comparing treatment 'treat1' and 'treat2'.
  • seTEStandard error of treatment estimate.
  • studlabStudy labels.
  • treat1First treatment in comparison.
  • treat2Second treatment in comparison.
  • event1Number of events for first treatment arm (for metabin and metainc).
  • event2Number of events for second treatment arm (for metabin and metainc).
  • n1Number of observations for first treatment arm (for metabin and metacont).
  • n2Number of observations for second treatment arm (for metabin and metacont).
  • mean1Estimated mean for first treatment arm (for metacont).
  • mean2Estimated mean for second treatment arm (for metacont).
  • sd1Standard deviation for first treatment arm (for metacont).
  • sd2Standard deviation for second treatment arm (for metacont).
  • TE1Estimated treatment effect for first treatment arm (for metagen).
  • TE2Estimated treatment effect for second treatment arm (for metagen).
  • seTE1Standard error of estimated treatment effect for first treatment arm (for metagen).
  • seTE2Standard error of estimated treatment effect for second treatment arm (for metagen).
  • time1Person time at risk for first treatment arm (for metainc).
  • time2Person time at risk for second treatment arm (for metainc).

Details

R function netmeta expects data in a contrast-based format, where each row corresponds to a comparison of two treatments and contains a measure of the treatment effect comparing two treatments with standard error, labels for the two treatments and an optional study label. Other programs, e.g. WinBUGS, require data in an arm-based format, i.e. treatment estimate for each treatment arm instead of a difference of the two or more treatments. For example, in contrast-based format, a three-arm study contributes three rows with treatment comparison and corresponding standard error for comparison A vs B, A vs C, and B vs C, whereas, in arm-based format, this study contributes one row with three treatment estimates and corresponding standard error for treatment A, B, and C.

The pairwise function transforms data given in an arm-based format into the contrast-based format which is needed as input to R function netmeta.

The pairwise functions expects a number of lists as mandatory input depending on the type of data (see next paragrah). List elements can be part of a data frame (argument data, optional). Each list entry is a vector with information for each individual study; the length of this vector corresponds to the total number of studies incorporated in the network meta-analysis. An optional vector with study labels can be provided; again this vector can be part of the data frame provided with argument data.

Pairwise can transform data with binary outcomes (using the metabin function from R package meta), continuous outcomes (metacont function), incidence rates (metainc function), and generic outcomes (metagen function). The following lists are mandatory for these different outcome types:

Additional arguments for these functions, e.g. argument sm to specify the summary measure, can be provided using argument .... The treat list is mandatory to identify the individual treatments. Each list consists of as many vectors as the multi-arm study with the largest number of treatments. If a single multi-arm study has five arms, five vectors have to be provided for each lists. Two-arm studies have entries with NA for the third and subsequent vectors. The value of pairwise is a data frame with as many rows as there are pairwise comparisons. For each study with p treatments, p*(p-1)/2 contrasts are generated. Each row contains the treatment effect, its standard error, the treatments compared and the study label. Further columns are added according to type of data.

See Also

netmeta, metacont, metagen, metabin, metainc, netgraph

Examples

Run this code
#
# Example using continuous outcomes (internal call of function metacont)
#
data(parkinson)
# Transform data from arm-based format to contrast-based format
p1 <- pairwise(list(Treatment1, Treatment2, Treatment3),
               n=list(n1, n2, n3),
               mean=list(y1, y2, y3),
               sd=list(sd1, sd2, sd3),
               data=parkinson, studlab=Study)
p1

# Conduct network meta-analysis
net1 <- netmeta(TE, seTE, treat1, treat2, studlab, data=p1)
net1

# Draw network graphs
netgraph(net1, points=TRUE, cex.points=3, cex=1.5,
         thickness="se.fixed")
netgraph(net1, points=TRUE, cex.points=3, cex = 1.5,
         plastic=TRUE, thickness="se.fixed",
         iterate=TRUE)
netgraph(net1, points=TRUE, cex.points=3, cex = 1.5,
         plastic=TRUE, thickness="se.fixed",
         iterate=TRUE, start="eigen")


#
# Example using generic outcomes (internal call of function metagen)
#
# Calculate standard error for means y1, y2, y3
parkinson$se1 <- with(parkinson, sqrt(sd1^2/n1))
parkinson$se2 <- with(parkinson, sqrt(sd2^2/n2))
parkinson$se3 <- with(parkinson, sqrt(sd3^2/n3))
# Transform data from arm-based format to contrast-based format using
# means and standard errors (note, argument 'sm' has to be used to
# specify that argument 'TE' is a mean difference)
p2 <- pairwise(list(Treatment1, Treatment2, Treatment3),
               TE=list(y1, y2, y3),
               seTE=list(se1, se2, se3),
               data=parkinson, studlab=Study,
               sm="MD")
p2

# Compare pairwise objects p1 (based on continuous outcomes) and p2
# (based on generic outcomes)
all.equal(p1[, c("TE", "seTE", "studlab", "treat1", "treat2")],
          p2[, c("TE", "seTE", "studlab", "treat1", "treat2")])

# Same result as network meta-analysis based on continuous outcomes
# (object net1)
net2 <- netmeta(TE, seTE, treat1, treat2, studlab, data=p2)
net2


#
# Example with binary data
#
data(smokingcessation)
# Transform data from arm-based format to contrast-based format
# (interal call of metabin function). Argument 'sm' has to be used for
# odds ratio as risk ratio (sm="RR") is default of metabin function.
p3 <- pairwise(list(treat1, treat2, treat3),
               list(event1, event2, event3),
               list(n1, n2, n3),
               data=smokingcessation,
               sm="OR")
p3

# Conduct network meta-analysis
net3 <- netmeta(TE, seTE, treat1, treat2, studlab, data=p3)
net3

#
# Example with incidence rates
#
data(dietaryfat)

# Transform data from arm-based format to contrast-based format
p4 <- pairwise(list(treat1, treat2, treat3),
               list(d1, d2, d3),
               time=list(years1, years2, years3),
               studlab=ID,
               data=dietaryfat)
p4

# Conduct network meta-analysis using incidence rate ratios (sm="IRR").
# Note, the argument 'sm' is not necessary as this is the default in R
# function metainc called internally
net4 <- netmeta(TE, seTE, treat1, treat2, studlab, data=p4, sm="IRR")
summary(net4)

Run the code above in your browser using DataLab