Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

plot_blrm

Plot a fitted model


Description

**Warning**: these methods are at an experimental stage of development, and may change with future releases.

Plotting methods for blrmfit and blrm_trial objects. plot_toxicity_curve plots continuous profiles of the dose-toxicity curve. plot_toxicity_intervals plots the posterior probability mass in subintervals of [0,1].

Usage

plot_toxicity_curve(
  object,
  newdata,
  x,
  group,
  xlim,
  ylim,
  transform,
  prob,
  prob_outer,
  size,
  alpha,
  facet_args = list(),
  hline_at,
  grid_length
)

plot_toxicity_intervals(
  object,
  newdata,
  x,
  group,
  interval_prob,
  interval_max_mass,
  ewoc_colors
)

## Default S3 method:
plot_toxicity_curve(
  object,
  newdata,
  x,
  group,
  xlim,
  ylim,
  transform = TRUE,
  prob = 0.5,
  prob_outer = 0.95,
  size = 0.75,
  alpha = 1,
  facet_args = list(),
  hline_at = c(0.16, 0.33),
  grid_length = 100
)

## S3 method for class 'blrm_trial'
plot_toxicity_curve(
  object,
  newdata,
  x,
  group,
  xlim,
  ylim,
  transform = TRUE,
  prob = 0.5,
  prob_outer = 0.95,
  size = 0.75,
  alpha = 1,
  facet_args = list(),
  hline_at = c(0.16, 0.33),
  grid_length = 100
)

## Default S3 method:
plot_toxicity_intervals(
  object,
  newdata,
  x,
  group,
  interval_prob = c(0, 0.16, 0.33, 1),
  interval_max_mass = c(NA, NA, 0.25),
  ewoc_colors = c("green", "red")
)

## S3 method for class 'blrm_trial'
plot_toxicity_intervals(
  object,
  newdata,
  x,
  group,
  interval_prob,
  interval_max_mass,
  ewoc_colors = c("green", "red")
)

Arguments

object

fitted model object

newdata

optional data frame specifying for what to predict; if missing, then the data of the input model object is used. If object is a blrmfit object, newdata defaults to the data argument. If object is a blrm_trial, it defaults to summary(object, "dose_info").

x

Character giving the parameter name to be mapped to the x-axis. This also supports 'tidy' parameter selection by specifying 'x = vars(...)', where '...' is specified the same way as in [dplyr::select(...)][dplyr::select] and similar functions. Examples of using 'x' in this way can be found in the examples.

group

Grouping variable(s) whose levels will be mapped to different facets of the plot. 'group' can be a character vector, tidy parameter(s) of the form 'group = vars(...)', or a formula to be passed directly to [ggplot2::facet_wrap].

xlim

x-axis limits

ylim

y-axis limits on the probability scale

transform

logical (defaults to FALSE) indicating if the linear predictor on the logit link scale is transformed with inv_logit to the 0-1 response scale.

prob

central probability mass to report for the inner ribbon, i.e. the quantiles 0.5-prob/2 and 0.5+prob/2 are displayed.

prob_outer

central probability mass to report for the outer ribbon, i.e. the quantiles 0.5-prob/2 and 0.5+prob/2 are displayed.

alpha, size

Arguments passed to geoms. For this plot, alpha is passed to [ggplot2::geom_ribbon()], and size is passed to [ggplot2::geom_line].

facet_args

A named list of arguments (other than 'facets') passed to [ggplot2::facet_wrap()].

hline_at

Location(s) of horizontal guide lines (passed to [bayesplot::hline_at]).

grid_length

Number of grid points within xlim for plotting.

interval_prob

defines the interval probabilities reported in the standard outputs. Defaults to c(0, 0.16, 0.33, 1).

interval_max_mass

vector defining for each interval of the interval_prob vector a maximal admissible probability mass for a given dose level. Whenever the posterior probability mass in a given interval exceeds the threshold, then the Escalation With Overdose Control (EWOC) criterion is considered to be not fulfilled. Dose levels not fulfilling EWOC are ineligible for the next cohort of patients. The default restricts the overdose probability to less than 0.25.

ewoc_colors

Fill colors used for bars indicating EWOC OK or not. Vector of two characters, each of which must correspond to bayesplot package color schemes (see ?bayesplot::color_scheme_get)

Details

Plots the dose-toxicity curve, with P(DLT) on the vertical axis and dose of "drug_name_x" on the horizontal.

Value

A ggplot object that can be further customized using the **ggplot2** package.

See Also

Examples

## Setting up dummy sampling for fast execution of example
## Please use 4 chains and 100x more warmup & iter in practice
.user_mc_options <- options(OncoBayes2.MC.warmup=10, OncoBayes2.MC.iter=20, OncoBayes2.MC.chains=1)

library(dplyr) # for vars()

example_model("combo2")
plot_toxicity_curve(blrmfit,
                    x = vars(drug_A),
                    group = ~ group_id * drug_B,
                    newdata = filter(dose_info_combo2, group_id == "trial_AB"),
                    facet_args = list(ncol = 4))
plot_toxicity_intervals(blrmfit,
                        x = vars(drug_A),
                        group = ~ group_id * drug_B,
                        newdata = filter(dose_info_combo2, group_id == "trial_AB"))
## Recover user set sampling defaults
options(.user_mc_options)

OncoBayes2

Bayesian Logistic Regression for Oncology Dose-Escalation Trials

v0.7-0
GPL (>= 3)
Authors
Novartis Pharma AG [cph], Sebastian Weber [aut, cre], Lukas A. Widmer [aut], Andrew Bean [aut], Trustees of Columbia University [cph] (R/stanmodels.R, configure, configure.win)
Initial release
2021-05-07

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.