Description Usage Arguments Details Value Author(s) See Also Examples
This function transforms data from long arm-based format, i.e., two rows for a pairwise comparison, to a list format for Bayesian network meta-analysis using JAGS.
1 2 3 4 5 6 7 8 9 10 11 12 |
studlab |
A vector with study labels or an object created with
|
treat |
A vector with treatment labels (mandatory if
|
event |
Number of events. |
n |
Number of observations. |
mean |
Estimated mean. |
sd |
Standard deviation. |
data |
An optional data frame containing the study information. |
reference.group |
Reference treatment. |
covar |
Covariable to use in network meta-regression. |
func |
A character string specifying function to summarize data for additional covariate. Either, "min", "max", "mean", or ""; can be abbreviated. |
This function transforms data from long arm-based format, i.e., two rows for a pairwise comparison, to a list format for Bayesian network meta-analysis using JAGS.
At the moment, the function can be used to transform data with a
binary or continuous outcome. The following arguments are mandatory
if argument studlab
is not an R object created with
longarm
. Arguments studlab
and
treat
must be provided to identify studies and treatments
and, depending on the outcome, the following additional arguments:
event
, n
(binary outcome);
n
, mean
, sd
(continuous outcome).
A list of class jagsdata
.
Georgia Salanti georgia.salanti@ispm.unibe.ch, Guido Schwarzer sc@imbi.uni-freiburg.de
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 | ## Not run:
library(netmeta)
data(Dogliotti2014)
Dogliotti2014$trt <- treats(Dogliotti2014$treatment, nchar = 4)
#
p1 <- pairwise(trt, stroke, total, studlab = study,
data = Dogliotti2014, sm = "OR")
# Standard frequentist random effects NMA model
#
n1.iv <- netmeta(p1)
# Standard Bayesian random effects NMA model
#
library(R2jags)
# Transform long-arm based data into a list suitable for JAGS
# analysis, with placebo as reference treatment
#
dat.jags <- long2jags(study, trt,
event = stroke, n = total,
data = Dogliotti2014,
reference = "pl")
# Run JAGS and create JAGS object
#
n1.jags <- netjags(dat.jags)
# Extract lnOR from BUGS output
#
trts <- attr(n1.jags, "trts")
TE.random <- n1.jags$BUGSoutput$mean$LOR.full
rownames(TE.random) <- trts
colnames(TE.random) <- trts
# Extract se(lnOR) from BUGS output
#
seTE.random <- n1.jags$BUGSoutput$sd$LOR.full
rownames(seTE.random) <- trts
colnames(seTE.random) <- trts
# Conduct frequentist NMA with tau from Bayesian NMA
#
tau.jags <- as.numeric(n1.jags$BUGSoutput$mean$tau)
n1.iv.jags <-
suppressWarnings(netmeta(p1, tau.preset = tau.jags))
# Print treatment matrix for frequentist NMA
#
round(n1.iv$TE.random, 3)[trts, trts]
# Print treatment matrix for Bayesian NMA
#
round(TE.random, 3)
# Print treatment matrix for frequentist NMA
# (using tau from Bayesian NMA)
#
round(n1.iv.jags$TE.random, 3)[trts, trts]
# Print standard errors from frequentist NMA
#
round(n1.iv$seTE.random, 3)[trts, trts]
# Print standard errors from Bayesian NMA
#
round(seTE.random, 3)
# Print standard errors from frequentist NMA
# (using tau from Bayesian NMA)
#
round(n1.iv.jags$seTE.random, 3)[trts, trts]
# Print square root of between-study heterogeneity tau2
#
tau.jags
n1.iv$tau
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.