In the general introductory CRM vignette, we introduced the different flavours of the Continual Reassessment Method (CRM) implmented in trialr. In this vignette, we demonstrate some visualisation methods that will be useful for conveying inferences to investigators and the wider research community.

The following visualisation methods are applicable in all trialr variants of the CRM because they rely only on the family of prob_tox parameters that are estimated by all CRM models.

For illustration, let us assume that we have treated 6 patients at 3 dose-levels:

Patient Cohort Dose-level DLT
1 1 2 0
2 1 2 0
3 2 3 0
4 2 3 0
5 3 4 1
6 3 4 1

and that we are using the empiric CRM with the following prior to target the dose with Pr(DLT) closest to 25%:

To access the Stan implementations of the CRM, we must load trialr:

and to fit the data to the model, we run:

mod <- stan_crm(outcomes, skeleton = skeleton, target = target, 
                beta_sd = sqrt(1.34), seed = 123)
mod

Recall that we set the random number generator seed in demonstrations for reproducibility. You may or may not choose to do this in a real analysis.

We saw before that dose-level 2 is closest to our target toxicity rate of 25%. However, we will probably like to convey this information to the research world in a visually-appealing manner. This is simple with access to the posterior samples.

For ease of plotting with ggplot2, we recompose the posterior samples to a tall “tidy” format using tidyr and dplyr:

The tidy data looks like this:

##          Label     ProbTox DoseLevel Draw
## 1  prob_tox[1] 0.008326509         1    1
## 2  prob_tox[1] 0.000414021         1    2
## 3  prob_tox[1] 0.010375602         1    3
## 4  prob_tox[1] 0.080044987         1    4
## 5  prob_tox[1] 0.001089827         1    5
## 6  prob_tox[1] 0.001089827         1    6
## 7  prob_tox[1] 0.176749419         1    7
## 8  prob_tox[1] 0.145957259         1    8
## 9  prob_tox[1] 0.193753739         1    9
## 10 prob_tox[1] 0.498104632         1   10

Boxplots would be a traditional way of visualising the distributions of the probability of toxicity at each dose:

library(ggplot2)

(p1 <- ggplot(prob_tox_samp_tall, aes(x = DoseLevel, y = ProbTox, group = DoseLevel)) +
  geom_boxplot() + ylim(0, 1) + labs(title = 'boxplot of Pr(DLT) under CRM'))

However, boxplots give only limited information on the distributions. For instance, it might be tempting to assume that the probability of toxicity is normally distributed at each dose-level. The boxplots suggest some wide tails. This inference is much more clear, however, using a violin-plot:

(p2 <- ggplot(prob_tox_samp_tall, aes(x = DoseLevel, y = ProbTox, group = DoseLevel)) +
    geom_violin(fill = 'orange') + ylim(0, 1) + labs(title = 'violin plot of Pr(DLT) under CRM'))

If you are a fan of post-punk UK music (and you have installed the ggridges package), you may however prefer to show this information using a ridge plot, aka a joyplot

## 
## Attaching package: 'ggridges'
## The following object is masked from 'package:ggplot2':
## 
##     scale_discrete_manual
ggplot(prob_tox_samp_tall %>% mutate(DoseLevel = factor(DoseLevel)),
       aes(x = ProbTox, y = DoseLevel, fill = DoseLevel)) +
  geom_density_ridges() + theme(legend.position = 'none') +
  labs(title = 'joyplot of Pr(DLT) under CRM')
## Picking joint bandwidth of 0.0247

Hopefully none of us would try to claim these posterior probabilities of toxicity are normally distributed under this model. Assuming normality has been one method for performing posterior inference with CRM models in the non-MCMC setting. With the posterior samples provided by rstan, we do not need to assume.

We will naturally want to visualise quantities beyond just the probability of toxicity. We learned in the introductory CRM vignette that with the full Bayesian CRM provided by trialr and rstan, we can calculate the probability that each dose is the maximum tolerable dose (MTD). The natural next step is to visualise that trade-off:

library(magrittr)

apply(prob_tox_samp, 1, function(x) which.min(abs(x - target))) %>% 
  data.frame(Dose = .) %>% 
  ggplot() + stat_count(aes(x = Dose, y = ..prop.., group = 1)) +
  labs(title = 'Posterior probability that each dose is the MTD',
       y = 'Prob(MTD)')

In this interim stage, each of the first four doses could plausibly be the MTD, but the top dose looks unlikely. This information was not readily available from the above plots of the probabilities of toxicity.

We might also like to visualise the probability that the toxicity rate at each dose exceeds our target toxicity rate.

colMeans(prob_tox_samp > target) %>% 
  data.frame(ProbToxic = ., DoseLevel = 1:length(skeleton)) %>%
  ggplot(aes(x = DoseLevel, y = ProbToxic)) + geom_col() + 
  labs(title = 'Posterior probability that each dose is too toxic',
       y = 'Prob(Tox > target)')

Based on our prior and the data assembled thus far, dose-levels 4 and 5 are likely to be overdoses.

Other CRM vignettes

There are many vignettes illuminating the CRM in trialr:

References