-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.Rmd
76 lines (52 loc) · 3.04 KB
/
README.Rmd
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
---
output: github_document
---
```{r, echo = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "README-"
)
```
# Model Tuberculosis, including BCG vaccination, in England
`ModelTBBCGEngland` is an R package that contains models, summarised data, and fitting scripts for a model of TB, including BCG vaccination, fit to routine surveillance data in England.
## Installation
You can install `ModelTBBCGEngland` directly from github with:
```{r gh-installation, eval = FALSE}
# install.packages("devtools")
devtools::install_github("seabbs/ModelTBBCGEngland")
```
### Model development
For a discussion of the model development process please see [here](https://www.samabbott.co.uk/thesis/8-model-development.html). For a discussion of the model fitting pipeline please see [here](https://www.samabbott.co.uk/thesis/9-model-fitting.html).
### Model fitting
Run the following code in the terminal after installing and building the package and opening the Rstudio project. The results (and logs) will be found at `./vignettes/results`.
```{bash, eval = FALSE}
nohup Rscript inst/scripts/run-scenarios.R --sample_priors --fit --reports
```
To fit only the main scenario add `--scenario baseline`. If interested in rapid exploration or if using limited compute resources experiment with the `--calib_run` flag which uses point estimates for the initial conditions and process noise - reducing the number of particles required. Alternatively explore the other options available using `--help`. An example of a fitting run used for exploration is below.
```{bash, eval = FALSE}
nohup Rscript inst/scripts/run-scenarios.R --sample_priors --fit --reports --cores 16 --calib_run --scenario baseline
```
For more interactive testing see `./tests/manual-tests/test-rbi-fit.R`. This script was used during pipeline development.
### Using docker
This analysis was developed in a docker container based on the [tidyverse](https://hub.docker.com/r/rocker/tidyverse/) docker image. To run the docker image run:
```{bash, eval = FALSE}
docker run -d -p 8787:8787 -e USER=ModelTBBCGEngland -e PASSWORD=ModelTBBCGEngland \
--mount type=bind,source=$(pwd)/results/modeltbbcgengland,target=/home/rstudio/ModelTBBCGEngland/vignettes/results \
--mount type=bind,source=$(pwd)/data/tb_data,target=/home/rstudio/ModelTBBCGEngland/data-raw/tb_data \
--name modeltransvsdirect seabbs/modeltbbcgengland
```
This command expects both a data and results folder to be available to be mounted. Create them using the following (Mac/Linux).
```{bash, eval = FALSE}
mkdir -p results/modeltbbcgengland
mkdir -p data/tb_data
```
The rstudio client can be found on port `:8787` at your local machines ip. The default username:password is seabbs:seabbs, set the user with `-e USER=username`, and the password with ` - e PASSWORD=newpasswordhere`.
To run a plain R terminal use:
```{bash, eval = FALSE}
docker run --rm -it --user seabbs modeltbbcgengland /usr/bin/R
```
To run a plain bash session:
```{bash, eval = FALSE}
docker run --rm -it --user seabbs modeltbbcgengland /bin/bash
```