The escalation
package by Kristian Brock.
Documentation is hosted at https://brockk.github.io/escalation/
knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
To provide dose selection decisions, the escalation
package daisy-chains together objects that support a common interface, each deriving from type selector
.
This vignette demonstrates the entire interface supported by selector
objects.
For the purpose of illustratration, we use a BOIN selector but the same functions will work on every type of dose selector in escalation
.
library(escalation)
model <- get_boin(num_doses = 5, target = 0.3) fit <- model %>% fit('1NN 2NN 3NT 2NT')
Target toxicity rate:
tox_target(fit)
The number of patients treated:
num_patients(fit)
Cohort IDs for the treated patients:
cohort(fit)
The code infers from the spaces in the outcome string that a dose-decision was made after the second, fourth , and sixth patients.
Integers representing the dose-levels given:
doses_given(fit)
Bits representing whether toxicity event was observed:
tox(fit)
The total number of toxicities seen at all doses combined:
num_tox(fit)
A data-frame containing the above information:
model_frame(fit)
The number of doses under investigation:
num_doses(fit)
The indices of the dose-levels under investigation:
dose_indices(fit)
The dose-level recommended for the next patient:
recommended_dose(fit)
After seeing some toxicity at doses 2 and 3, the design sensibly sticks at dose 2 for the time being.
A logical value for whether accrual should continue:
continue(fit)
We infer from this that no stopping condition has yet been triggered.
The number of patients treated at each dose:
n_at_dose(fit)
The number of patients treated at the recommended dose:
n_at_recommended_dose(fit)
The proportion of patients treated at each dose:
prob_administer(fit)
The total number of toxicities seen at each dose:
tox_at_dose(fit)
The empirical toxicity rate, i.e. the number of toxicities divided by the number of patients:
empiric_tox_rate(fit)
The model-derived expected toxicity rate at each dose:
mean_prob_tox(fit)
The BOIN design makes no estimate for doses it has not yet administered.
The model-derived median toxicity rate at each dose:
median_prob_tox(fit)
BOIN does not actually calculate posterior median estimates. Sometimes it will be necessary to return missing values if functionality is not supported by a model. Median estimates could be added to the BOIN class in due course.
The model-derived quantile of the toxicity rate at each dose:
prob_tox_quantile(fit, 0.9)
BOIN does not calculate this either. It could also be added.
The posterior probability that the toxicity rate exceeds some threshold value, here 50%:
prob_tox_exceeds(fit, 0.5)
Once again, no estimate is made for non-administered doses. We see that the model estimates a trivial chance that the toxicity rate at the lowest dose exceeds 50%.
Learn if this model supports sampling from the posterior:
supports_sampling(fit)
The BOIN model does not support sampling.
If it did, we could run prob_tox_samples(fit)
.
We can also call some standard generic functions:
print(fit)
summary(fit)
and cast it to a tidyverse tibble
:
library(tibble) as_tibble(fit)
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.