survnma: Survival network meta-analysis models

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/survnma.R

Description

survnma provides interface for Bayesian NMA WinBUGS models (specifically through R2WinBUGS). It generates samples from the posterior distribution and interprets them in terms of survivals and hazards.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
survnma(
  nma_df = NULL,
  model = "exponential",
  type = "fixed",
  prior = NULL,
  P = NULL,
  inits = "generate",
  n.chains = 3,
  n.iter = 5000,
  auto_restart = FALSE,
  connected_check = TRUE,
  warnings = TRUE,
  bugs.directory = "C:/WinBUGS14",
  min_time_change = 0,
  ...
)

Arguments

nma_df

a data.frame with columns treatment, study, baseline and filepath; each filepath should be a path to a text file corresponding to a Kaplan-Meier curve; each file should have 3 columns, in the following order: time, number at risk, number of events. Names of columns do not matter. Refer to read_km_folder for automatically creating inputs from folders of text files.

model

string; family of survival curves to use Use one of: weibull, gompertz, exponential lognormal, loglogistic, fp1, fp2. The last two refer to fractional polynomials of order one and two.

type

a string of characters indicated whether you are considering "fixed" or "random" effects when modelling the data

prior

a list of prior values, with elements mean, prec2 and R to be passed to WinBUGS; if prior=NULL, the defaults are used; dimensionality of values must be same as of the model (1 for exponential, 3 for fp2, 2 for the rest); mean is mean treatment effect (TE), default is 0; prec2 is precision of TE, default is 0.001*Identity R is scale matrix of Wishart, only used in random effects model, default is Identity; if using informative priors, we recommend setting inits=NULL or generating by hand

P

numeric or vector of numbers indicating the powers to be used when considering fractional polynomials (can be NULL)

inits

if inits="generate", initial values will be generated automatically within R, using Normal(0, 1) for d1/mu1 and Normal(0, 0.1^2) for d2/mu2 values; if inits=NULL, they will be generated automatically by WinBUGS and much more variable than when generated within R; if list is supplied, it will be used in a standard WinBUGS way (see bugs)

n.chains

number of chains for WinBUGS to use, default is 3

n.iter

integer specifying how many interations to be ran

auto_restart

Boolean to continue running model until convergence or stop after 5 iterations

connected_check

logical; if FALSE, does not check if network is connected

warnings

logical; if FALSE, warning messages about lack of convergence are skipped

bugs.directory

WinBUGS directory path; defaults to C:/WinBUGS14

min_time_change

numeric; a threshold for merging data points where differences in time are very small (see Details). We suggest a range of 0.01-0.05. Default of 0 does not modify any data.

...

additional parameters passed to bugs (e.g. inits, n.iter)

Details

WinBUGS implementation is through R2WinBUGS package. Additional arguments can be passed via ..., including bugs.directory. We use default of C:/WinBUGS14/.

WinBUGS models code follows publications of M.J. Ouwens and J.P. Jansen (see References). Models can be viewed with survnma_model.

Input data have to follow a particular format, typically obtained from read_km_folder but data.frame of inputs can also be specified manually.

Both initial values and priors can be specified by hand. To understand how they are used, it is recommended to inspect the model with survnma_model first. The default generation of initial values (inits = "generate") is optimised toward default vague priors. When using informative priors it is best to set inits = NULL.

Value

a survnma class object

Author(s)

Witold Wiecek, Savvas Pafitis

References

(1) Ouwens, Mario J. N. M., Zoe Philips, and Jeroen P. Jansen. “Network Meta-Analysis of Parametric Survival Curves.” Research Synthesis Methods 1, no. 3–4 (July 2010): 258–71. https://doi.org/10.1002/jrsm.25.

(2) Jansen, Jeroen P. “Network Meta-Analysis of Survival Data with Fractional Polynomials.” BMC Medical Research Methodology 11, no. 1 (May 6, 2011): 61. https://doi.org/10.1186/1471-2288-11-61.

See Also

vignette(survivalnma_guide) for overview, for working with outputs survival_plot and hazard_plot

Examples

 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
# We read data from some included data files:
nma_df <- data.frame(
             stringsAsFactors = FALSE,
             "treatment" = c("Suni", "Ifn", "Suni", "Pazo"),
             "study" = c("Study 1", "Study 1", "Study 2", "Study 2"),
             "baseline" = c("Suni", "Suni", "Suni", "Suni"),
             "filepath" = sapply(c("Mota_OS_Suni_KM.txt",
                                   "Mota_OS_Ifn_KM.txt",
                                   "Mot_OS_Suni_KM.txt",
                                   "Mot_OS_Pazo_KM.txt"), function(x)
              system.file("extdata", "narrow", x, 
                          package="survivalnma", mustWork=TRUE)))

# example of simple survnma models (fixed effects)
fit_wbl <- survnma(nma_df, "weibull", min_time_change = 0.05)
fit_fp2 <- survnma(nma_df, "fp2", P = c(-1,0), min_time_change = 0.05)

#manually setting a (very informative) prior
#dimension of prior is 2 as Weibull is 2-parameter dist.
fit_wbl <- survnma(nma_df, "weibull",
                   prior = list("mean" = c(1,1), "prec2" = .1*diag(2)),
                   min_time_change = 0.05)

#manually setting some WinBUGS options
survnma(nma_df, "weibull", n.iter = 10000, debug = TRUE)

certara/survivalnma documentation built on Oct. 17, 2020, 12:34 a.m.