-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.Rmd
157 lines (120 loc) · 5.13 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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
options(width = 200)
```
# My modified OncoBayes2
<!-- badges: start -->
<!-- badges: end -->
This is my modified version of the [original OncoBayes2](https://CRAN.R-project.org/package=OncoBayes2) package.
The most significant difference is the support of providing correlation parameter when sampling the component
via the newly added parameter `prior_EX_corr_mu_comp` in `blrm_exnex()`.
In the original package, $\theta = (log \alpha, log \beta) \sim N(\mu, \Sigma)$ where the __covariance__ matrix $\Sigma$ is a diagonal matrix whose diagonals are provided via `prior_EX_mu_sd_comp`(Note, this parameter provides the __standard variance__).
Now, the off-diagonal part of $\Sigma$ can also be specified by supplying the __correlation__ via `prior_EX_corr_mu_comp`.
## NOTE
1. This is just a __proof of concept__ during my replication of Table 14-7 in this [trial protocol](https://clinicaltrials.gov/ProvidedDocs/64/NCT02108964/Prot_001.pdf). The original OncoBayes2 misses the functionality
to accept user defined correlation, which is also reported on the [internet](https://stats.stackexchange.com/questions/617633/correlation-for-priors-in-blrm-with-ewoc-in-r-package-oncobayes2/626132#626132)
1. Currently this package is forked and modified from [CRAN's github version of OncoBayes2](https://github.com/cran/OncoBayes2). After installation it will __overwrite__ your existing OncoBayes2.
1. This is currently WIP. Many aspect, like the `prior_summary` method should be updated accordingly to reflect the correlation information. Also many document template is missing hence the manual cannot be auto-updated properly.
## Installation
You can install the development version of my modified OncoBayes2 like so:
``` r
remotes::install_github("fenguoerbian/MyOncoBayes2")
```
## Example
This is a basic example which reproduce the results in Table 14-7 in this [trial protocol](https://clinicaltrials.gov/ProvidedDocs/64/NCT02108964/Prot_001.pdf).
```{r example}
library(OncoBayes2)
```
### Setup MCMC options
```{r}
set.seed(123)
.user_mc_options <- options(OncoBayes2.MC.warmup=500, OncoBayes2.MC.iter=20000, OncoBayes2.MC.chains=10,
OncoBayes2.MC.save_warmup=FALSE, mc.cores = 10)
```
### Setup basic trial infomation
```{r}
SA_trial_setup <- blrm_trial(
data = tibble::tibble(group_id = as.factor("All"),
drug_A = 50,
num_patients = NA,
num_toxicities = NA),
# dose-toxicity data available at design stage of trial.
dose_info = tibble::tibble(group_id = as.factor("All"),
drug_A = c(50,75,150,300,450,600,800,1000),
dose_id = c(1, 2, 3, 4, 5, 6, 7, 8), stratum_id = "all"),
# specification of the dose levels as planned for the ongoing trial arms.
drug_info = tibble::tibble(drug_name = "drug_A",
dose_ref = 300,
dose_unit = "ug/kg"
,
reference_p_dlt = exp(-3.068) / (1 + exp(-3.068))
)
# specification of drugs used in trial arms
,simplified_prior = FALSE
,EXNEX_comp=TRUE
,EXNEX_inter=FALSE
,interval_prob = c(0,0.16,0.33,1)
,interval_max_mass = c(prob_underdose = 1 # The prob of under-dose is allowed maximum to 1.
, prob_target = 1 # The prob of target-dose is allowed maximum to 1.
, prob_overdose = 0.25) # The prob of over-dose is allowed maximum to 0.28.
)
dims <- summary(SA_trial_setup,"dimensionality")
num_comp <- dims$num_components
```
### Update the prior
```{r, message=FALSE}
dims <- summary(SA_trial_setup,"dimensionality")
num_comp <- dims$num_components
SA_trial_start <- update(
SA_trial_setup,
# component1 MAP prior
# check the usage in single agent example documentation.
prior_EX_mu_mean_comp = matrix(
c(-3.068, # mean of intercept
0.564), # mean of log-slope
nrow = num_comp,
ncol = 2
),
prior_EX_mu_sd_comp = matrix(
c(2.706, # sd of intercept
0.728), # sd of log-slope
nrow = num_comp,
ncol = 2
),
prior_EX_corr_mu_comp = -0.817, # HERE! supply the CORRELATION!
prior_EX_tau_mean_comp = matrix(
c(0, 0),
nrow = num_comp,
ncol = 2
),
prior_EX_tau_sd_comp = matrix(
c(1, 1),
nrow = num_comp,
ncol = 2
),
prior_EX_prob_comp = matrix(1, nrow = 1, ncol = 1),
prior_tau_dist = 0, # single-agent, without historical data, set this to 0.
# see single-agent example in this package for more details
prior_PD = FALSE
)
```
__NOTE:__ `prior_summary` needs to be updated to reflect user supplied correlation
```{r}
prior_summary(SA_trial_start)
```
### Check the results against Table 14-7
```{r}
summary(SA_trial_start, "dose_prediction")
```
```{r}
summary(SA_trial_start, "ewoc_check")
```