Switch to unified view

a b/vignettes/biomkrAccrual.Rmd
1
---
2
title: "biomkrAccrual"
3
author: "SJ Cowtan"
4
date: 2024-10-01
5
date-format: YYYY
6
output: 
7
  - rmarkdown::html_vignette
8
vignette: >
9
  %\VignetteIndexEntry{biomkrAccrual}
10
  %\VignetteEngine{knitr::rmarkdown}
11
  %\VignetteEncoding{UTF-8}
12
---
13
14
```{r, include = FALSE}
15
knitr::opts_chunk$set(
16
  collapse = TRUE,
17
  comment = "#>"
18
)
19
```
20
21
```{r setup}
22
library(biomkrAccrual)
23
```
24
25
Simulating recruitment at time of randomisation to adaptive trials with 
26
arm eligibility determined by biomarker status.
27
28
The `{biomkrAccrual}` package uses a Poisson-Gamma-Dirichlet model to simulate
29
trial recruitment for multi-site, multi-region, multi-arm trials. Recruitment per 
30
site is modelled with the Poisson-Gamma model (Anisimov and Federov, 2007).
31
A hierarchical Dirichlet model is used to model biomarker proportions for sites
32
within regions. Recruitment to a given site in a given week is then randomised
33
to biomarker status using the prevalences drawn from the Dirichlet model for that
34
site.
35
36
## Running a single simulation
37
38
`biomkrAccrual()`
39
40
The default settings will use the configuration files in the `extdata` directory, and will
41
keep the resulting data files and recruitment plots. The location can be specified with 
42
`output_path` and `figs_path`.
43
44
## Running a set of simulations
45
46
`biomkrAccrualSim(n = 250)`
47
48
The datafiles and recruitment plots from the individual runs will not be kept (this
49
can be changed with `quietly = FALSE`) but will preserve the summary datafiles and
50
distribution plots.
51
52
## Practical notes
53
54
There are a very large number of arguments to both commands, and three configuation files,
55
one of which (the relationship of treatment arms to biomarker recruitment arms) is a JSON.  
56
This is because flexibility is required, and they are intended to be driven by a dashboard 
57
in future.
58
59
This package will not pass R CMD Check because it is written using the new object orientation 
60
system for R, `{S7}`, and CMD Check does not yet understand the syntax.
61
62
63
Anisimov, V.V., Fedorov, V.V., 2007. Modelling, prediction and adaptive adjustment of 
64
recruitment in multicentre trials. Statistics in Medicine 26, 4958–4975. 
65
https://doi.org/10.1002/sim.2956