sim3p3: Simulate 3+3 design

View source: R/simulate.R

sim3p3R Documentation

Simulate 3+3 design

Description

Simulate a standard 3+3 dose (de-)escalation study.

Usage

sim3p3(probs, expansion = 10, escalation = TRUE, n.max = Inf)

Arguments

probs

vector of true rates of DLTs

expansion

(optional) integer giving size of expansion cohort

escalation

logical; if TRUE, dose-escalation rules are used; otherwise, de-escalation rules are used with decreasing probs

n.max

maximum number of patients available for dose-finding and expansion cohorts combined

Value

A list with the following components:

$data

dose by patient matrix: 0 - no DLT, 1 - DLT

$summary

total number of DTLs, patients, and probability of DLT per dose level for escalation and total

$level

mtd level (i.e., row of data selected)

$mtd

DLT rate of dose level selected

$expansion

observed rate of DLT in expansion cohort

$cohort

observed rate of DLT in all patients

$enrolled

total number of patients enrolled on study

See Also

simcrm

Examples

## standard 3+3 with 10 patient expansion cohort
pr <- 1:5 / 10
sim3p3(pr)


## run 1000 3+3 studies
sim1 <- replicate(1000L, sim3p3(pr), simplify = FALSE)

op <- par(mfrow = c(1, 2), las = 1L)
out <- sapply(sim1, function(x) c(x$level, x$enrolled))
barplot(
  prop.table(table(out[1, ])),
  main = 'Dose selected',
  xlab = 'RP2D',
  ylab = 'Proportion selected'
)
boxplot(
  split(out[2, ], out[1, ]),
  ylim = c(0, length(pr) * 6 + 10),
  main = 'N used to select dose x',
  xlab = 'Dose selected\n(0 - no safe dose)',
  ylab = 'Total size'
)
par(op)


## 3+3 de-escalation, starting at highest dose
## run 1000 3+3 studies
pr2 <- rev(pr)
sim2 <- replicate(1000L, sim3p3(pr2, escalation = FALSE), simplify = FALSE)

op <- par(mfrow = c(1, 2), las = 1L)
out <- sapply(sim2, function(x) c(x$level, x$enrolled))
barplot(
  prop.table(table(out[1, ])),
  main = 'Dose selected',
  xlab = 'RP2D',
  ylab = 'Proportion selected'
)
boxplot(
  split(out[2, ], out[1, ]),
  ylim = c(0, length(pr) * 6 + 10),
  main = 'N used to select dose x',
  xlab = 'Dose selected\n(0 - no safe dose)',
  ylab = 'Total size'
)
par(op)


raredd/desmon2 documentation built on Feb. 9, 2023, 12:09 p.m.