knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
library(NMA) library(purrr)
Borrowing from the approach in the heemod
package, as well as defining the analysis in an R
script it is also possible to specify the analysis with only file inputs.
This vignette will show how to do this with a simple example.
The idea is to create folder with all of the information needed to run the NMA analysis contained in files within.
The meta information about the contents of the folder is contained in a reference file. The reference file is called REFERENCE.csv
.
This file contains two columns called type
and file
.
Rows in the type
column must contain one of the following keywords:
bugs
: File containing the BUGS input parameters for MCMCanalysis
: File containing the scenario informationsubData
: Mandatory NMA data. Required column headings of tx
, base
, study
, Lmean
, Lse
, multi_arm
survDataBin
: Optional binary data. Required column headings of tx
, base
, study
, BinN
, BinR
survDataMed
: Optional median time data. Required column headings of tx
, base
, study
, medN
, medR
, median
type
| file
-----|------
bugs
| bugs.csv
analysis
| analysis.csv
subData
| subData.csv
bugs.csv
includes: OpenBUGS or WinBUGS option PROG
, N.BURNIN
, N.SIMS
, N.CHAINS
, N.THIN
, PAUSE.
For example,
PROG, openBugs N.BURNIN, 1000 N.SIMS, 1500 N.CHAINS, 2 N.THIN, 1 PAUSE, TRUE
and analysis.csv
includes: whether a random effects model, is_random
; the type of survival data, data_type
the reference treatment, REFTX
; effectParam
, label
and endpoint
.
For example,
is_random, FALSE data_type, hr_data refTx, X effectParam, beta label, my_label endpoint, my_endpoint
A single call sets-up the NMA represented by the contents of the folder.
nma_model <- new_NMA_dir(data_dir = here::here("inst/analysis_folder_test"))
The NMA MCMC function calls the appropriate BUGS model in the usual way.
nma_res <- NMA_run(nma_model, save = FALSE) nma_res
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.