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.

Introduction

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.

Reference file

This file contains two columns called type and file. Rows in the type column must contain one of the following keywords:

type | file -----|------ bugs | bugs.csv analysis | analysis.csv subData | subData.csv

Parameter files

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_typethe 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

Running an NMA

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"))

Run MCMC

The NMA MCMC function calls the appropriate BUGS model in the usual way.

nma_res <- NMA_run(nma_model, save = FALSE)

nma_res


ICON-in-R/NMA documentation built on Nov. 14, 2023, 10:54 a.m.