Learn R Programming

trialr (version 0.0.7)

efftox_contour_plot: Plot EffTox utility contours

Description

Plot EffTox utility contours. The probability of efficacy is on the x-axis and toxicity on the y-axis. The zero-utility curve is plotted bolder. The three "hinge points" are plotted as blue triangles. Optional Prob(Efficacy) vs Prob(Toxicity) points can be added; these are shown as red numerals, enumerated in the order provided.

Usage

efftox_contour_plot(dat, use_ggplot = FALSE, prob_eff = NULL,
  prob_tox = NULL, num_points = 1000, util_vals = seq(-3, 3, by = 0.2))

Arguments

dat

An instance of efftox_params, a list of EffTox parameters. An example is yielded by efftox_parameters_demo.

use_ggplot

logical, TRUE to use ggplot2. Defaults to FALSE to use standard R graphics.

prob_eff

an optional vector of numbers between 0 and 1, containing the efficacy probabilities of extra points to add to the plot as points, e.g. the posterior mean efficacy probabilities of the doses under investigation. Paired with prob_tox, thus they should be the same length.

prob_tox

an optional vector of numbers between 0 and 1, containing the toxicity probabilities of extra points to add to the plot as points, e.g. the posterior mean toxicity probabilities of the doses under investigation. Paired with prob_eff, thus they should be the same length.

num_points

integer for number of points to calculate on each curve. The default is 1000 and this should be plenty.

util_vals

A contour is plotted for each of these utility values. The default is contours spaced by 0.2 between from -3 and 3, i.e. seq(-3, 3, by = 0.2).

Value

if use_ggplot = TRUE, an instance of ggplot; else no object is returned. Omit assignment in either case to just view the plot.

See Also

efftox_params

efftox_parameters_demo

Examples

Run this code
# NOT RUN {
dat <- efftox_parameters_demo()
efftox_contour_plot(dat)
# Add posterior beliefs
dat$num_patients <- 3
dat$eff <- c(0, 1, 1)
dat$tox <- c(0, 0, 1)
dat$doses <- c(1, 2, 3)
fit <- rstan::sampling(stanmodels$EffTox, data = dat)
decision <- efftox_process(dat, fit)
efftox_contour_plot(dat, prob_eff = decision$prob_eff,
                    prob_tox = decision$prob_tox)
title('EffTox utility contours')
# The same with ggplot2
efftox_contour_plot(dat, prob_eff = decision$prob_eff,
                    prob_tox = decision$prob_tox,
                    use_ggplot = TRUE) +
                    ggplot2::ggtitle('EffTox utility contours')

# }

Run the code above in your browser using DataLab