Learn R Programming

⚠️There's a newer version (2.1.0) of this package.Take me there.

crmPack

The goal of crmPack is to implement a wide range of model-based dose escalation designs, ranging from classical and modern continual reassessment methods (CRMs) based on dose-limiting toxicity endpoints to dual-endpoint designs taking into account a biomarker/efficacy outcome. The focus is on Bayesian inference, making it very easy to setup a new design with your own JAGS code. However, it is also possible to implement 3+3 designs for comparison or models with non-Bayesian estimation. The whole package is written in a modular form in the S4 class system, making it very flexible for adaptation to new models, escalation or stopping rules.

Installation

You can install the development version of crmPack from github with:

# install.packages("devtools")
devtools::install_github("Roche/crmPack")

You can install the stable release version of crmPack from CRAN with:

install.packages("crmPack")

Example

This is a basic example which shows how to run simulations from a CRM with a 2-parameter logistic regression model, using a log normal prior distribution, and custom cohort size, stopping and maximum increments rules:

library(crmPack)
#> Warning: package 'crmPack' was built under R version 3.4.4
#> Loading required package: ggplot2
#> Warning: package 'ggplot2' was built under R version 3.4.4
#> Type crmPackHelp() to open help browser
#> Type crmPackExample() to open example

# Define the dose-grid
emptydata <- Data(doseGrid = c(1, 3, 5, 10, 15, 20, 25, 40, 50, 80, 100))

# Initialize the CRM model 
model <- LogisticLogNormal(mean=c(-0.85, 1),
                           cov=
                             matrix(c(1, -0.5, -0.5, 1),
                                    nrow=2),
                           refDose=56)

# Choose the rule for selecting the next dose 
myNextBest <- NextBestNCRM(target=c(0.2, 0.35),
                           overdose=c(0.35, 1),
                           maxOverdoseProb=0.25)

# Choose the rule for the cohort-size 
mySize1 <- CohortSizeRange(intervals=c(0, 30),
                           cohortSize=c(1, 3))
mySize2 <- CohortSizeDLT(DLTintervals=c(0, 1),
                         cohortSize=c(1, 3))
mySize <- maxSize(mySize1, mySize2)

# Choose the rule for stopping
myStopping1 <- StoppingMinCohorts(nCohorts=3)
myStopping2 <- StoppingTargetProb(target=c(0.2, 0.35),
                                  prob=0.5)
myStopping3 <- StoppingMinPatients(nPatients=20)
myStopping <- (myStopping1 & myStopping2) | myStopping3

# Choose the rule for dose increments
myIncrements <- IncrementsRelative(intervals=c(0, 20),
                                   increments=c(1, 0.33))

# Initialize the design
design <- Design(model=model,
                 nextBest=myNextBest,
                 stopping=myStopping,
                 increments=myIncrements,
                 cohortSize=mySize,
                 data=emptydata,
                 startingDose=3)

## define the true function
myTruth <- function(dose)
{
  model@prob(dose, alpha0=7, alpha1=8)
}

# Run the simulation on the desired design
# We only generate 1 trial outcomes here for illustration, for the actual study 
# this should be increased of course
options <- McmcOptions(burnin=100,
                       step=1,
                       samples=2000)
time <- system.time(mySims <- simulate(design,
                                       args=NULL,
                                       truth=myTruth,
                                       nsim=1,
                                       seed=819,
                                       mcmcOptions=options,
                                       parallel=FALSE))[3]

Presentations

Copy Link

Version

Install

install.packages('crmPack')

Monthly Downloads

435

Version

1.0.3

License

GPL (>= 2)

Issues

Pull Requests

Stars

Forks

Maintainer

Daniel Saban<c3><a9>s Bov<c3><a9>

Last Published

September 2nd, 2022

Functions in crmPack (1.0.3)

CohortSizeMax

Initialization function for "CohortSizeMax"
CohortSizeDLT-class

Cohort size based on number of DLTs
CohortSizeMax-class

Size based on maximum of multiple cohort size rules
CohortSizeMin

Initialization function for "CohortSizeMin"
CohortSizeConst

Initialization function for "CohortSizeConst"
AllModels-class

Class for All models This is a class where all models inherit.
CohortSizeDLT

Initialization function for "CohortSizeDLT"
CohortSizeMin-class

Size based on minimum of multiple cohort size rules
CohortSize-class

The virtual class for cohort sizes
CohortSizeConst-class

Constant cohort size
CohortSizeParts

Initialization function for "CohortSizeParts"
Data

Initialization function for the "Data" class
Data-class

Class for the data input
CohortSizeRange-class

Cohort size based on dose range
CohortSizeParts-class

Cohort size based on the parts
DataMixture-class

Class for the data with mixture sharing
DataDual-class

Class for the dual endpoint data input
DataDual

Initialization function for the "DataDual" class
DualDesign-class

Class for the dual-endpoint CRM design
DualEndpointBeta-class

Dual endpoint model with beta function for dose-biomarker relationship
DualEndpointBeta

Initialization function for the "DualEndpointBeta" class
DualEndpointEmax

Initialization function for the "DualEndpointEmax" class
DualDesign

Initialization function for "DualDesign"
DualEndpointEmax-class

Dual endpoint model with emax function for dose-biomarker relationship
DataMixture

Initialization function for the "DataMixture" class
DualEndpoint

Initialization function for the "DualEndpoint" class
DualEndpoint-class

General class for the dual endpoint model
CohortSizeRange

Initialization function for "CohortSizeRange"
DualEndpointRW-class

Dual endpoint model with RW prior for biomarker
DataParts

Initialization function for the "DataParts" class
DataParts-class

Class for the data with two study parts
DualEndpointOld-class

Dual endpoint model
GeneralData-class

Class for general data input
DualResponsesSamplesDesign

Initialization function for 'DualResponsesSamplesDesign"
Design

Initialization function for "Design"
DualSimulations-class

Class for the simulations output from dual-endpoint model based designs
ExpEff

Compute the expected efficacy based on a given dose, a given pseudo Efficacy log-log model and a given efficacy sample
Design-class

Class for the CRM design
Effloglog-class

Class for the linear log-log efficacy model using pseudo data prior
Effloglog

Initialization function for the "Effloglog" class
DualEndpointRW

Initialization function for the "DualEndpointRW" class
EffFlexi-class

Class for the efficacy model in flexible form for prior expressed in form of pseudo data
DualResponsesDesign-class

This is a class of design based on DLE responses using the LogisticIndepBeta model model and efficacy responses using ModelEff model class without DLE and efficacy samples. It contain all slots in RuleDesign and TDDesign class object
EffFlexi

Initialization function for the "EffFlexi" class
GeneralSimulations

Initialization function for "GeneralSimulations"
GeneralSimulationsSummary-class

Class for the summary of general simulations output
IncrementMin-class

Max increment based on minimum of multiple increment rules
IncrementsNumDoseLevels-class

Increments control based on number of dose levels
Increments-class

The virtual class for controlling increments
IncrementsNumDoseLevels

Initialization function for "IncrementsNumDoseLevels"
DualSimulations

Initialization function for "DualSimulations"
DualSimulationsSummary-class

Class for the summary of dual-endpoint simulations output
DualResponsesSamplesDesign-class

This is a class of design based on DLE responses using the LogisticIndepBeta model model and efficacy responses using ModelEff model class with DLE and efficacy samples.It contain all slots in RuleDesign and TDsamplesDesign class object
DualResponsesDesign

Initialization function for 'DualResponsesDesign"
IncrementsRelative-class

Increments control based on relative differences in intervals
GeneralSimulations-class

General class for the simulations output
GeneralModel-class

No Intitialization function for this General class for model input
LogisticKadane

Initialization function for the "LogisticKadane" class
IncrementsRelativeDLT-class

Increments control based on relative differences in terms of DLTs
IncrementsRelativeDLT

Initialization function for "IncrementsRelativeDLT"
IncrementsRelativeParts

Initialization function for "IncrementsRelativeParts"
LogisticIndepBeta

Intialization function for "LogisticIndepBeta" class
IncrementsRelative

Initialization function for "IncrementsRelative"
LogisticKadane-class

Reparametrized logistic model
IncrementsRelativeParts-class

Increments control based on relative differences in intervals, with special rules for part 1 and beginning of part 2
LogisticNormal-class

Standard logistic model with bivariate normal prior
LogisticLogNormalSub

Initialization function for the "LogisticLogNormalSub" class
LogisticIndepBeta-class

No initialization function Standard logistic model with prior in form of pseudo data
LogisticLogNormal

Initialization function for the "LogisticLogNormal" class
LogisticLogNormal-class

Standard logistic model with bivariate (log) normal prior
LogisticNormalFixedMixture

Initialization function for the "LogisticNormalFixedMixture" class
ModelPseudo-class

Class of models using expressing their prior in form of Pseudo data
LogisticNormalMixture-class

Standard logistic model with flexible mixture of two bivariate normal priors
NextBestDualEndpoint-class

The class with the input for finding the next dose based on the dual endpoint model
IncrementMin

Initialization function for "IncrementMin"
NextBest-class

The virtual class for finding next best dose
LogisticNormal

Initialization function for the "LogisticNormal" class
LogisticNormalFixedMixture-class

Standard logistic model with fixed mixture of multiple bivariate (log) normal priors
LogisticNormalMixture

Initialization function for the "LogisticNormalMixture" class
NextBestDualEndpoint

Initialization function for "NextBestDualEndpoint"
ModelEff-class

No Initialization function class for Efficacy models using pseudo data prior
McmcOptions-class

Class for the three canonical MCMC options
LogisticLogNormalSub-class

Standard logistic model with bivariate (log) normal prior with substractive dose standardization
NextBestTD

Initialization function for the class "NextBestTD"
Model-class

Class for the model input
LogisticLogNormalMixture

Initialization function for the "LogisticLogNormalMixture" class
NextBestTDsamples-class

Next best dose based on Pseudo DLE Model with samples
ModelTox-class

No intialization function Class for DLE models using pseudo data prior. This is a class of DLE (dose-limiting events) models/ toxicity model which contains all DLE models for which their prior are specified in form of pseudo data (as if there is some data before the trial starts). It inherits all slots from ModelPseudo
NextBestMTD

Initialization function for class "NextBestMTD"
LogisticLogNormalMixture-class

Standard logistic model with online mixture of two bivariate log normal priors
NextBestMaxGainSamples

Initialization function for class "NextBestMaxGainSamples"
MinimalInformative

Construct a minimally informative prior
McmcOptions

Initialization function for the "McmcOptions" class
NextBestMaxGainSamples-class

Next best dose with maximum gain value based on a pseudo DLE and efficacy model with samples
NextBestMaxGain

Initialization function for the class 'NextBestMaxGain'
PseudoDualSimulations

Initialization function for 'DualPseudoSimulations' class
ProbitLogNormal

Initialization function for the "ProbitLogNormal" class
PseudoDualSimulationsSummary-class

Class for the summary of the dual responses simulations using pseudo models
NextBestMaxGain-class

Next best dose with maximum gain value based on a pseudo DLE and efficacy model without samples
NextBestNCRM-class

The class with the input for finding the next dose in target interval
NextBestThreePlusThree-class

The class with the input for finding the next dose in target interval
NextBestTDsamples

Initialization function for class "NextBestTDsamples"
PseudoDualFlexiSimulations-class

This is a class which captures the trial simulations design using both the DLE and efficacy responses. The design of model from ModelTox class and the efficacy model from EffFlexi class It contains all slots from GeneralSimulations, PseudoSimulations and PseudoDualSimulations object. In comparison to the parent class PseudoDualSimulations, it contains additional slots to capture the sigma2betaW estimates.
ProbitLogNormal-class

Probit model with bivariate log normal prior
NextBestThreePlusThree

Initialization function for "NextBestThreePlusThree"
PseudoDualFlexiSimulations

Initialization function for 'PseudoDualFlexiSimulations' class
NextBestTD-class

Next best dose based on Pseudo DLE model without sample
NextBestNCRM

Initialization function for "NextBestNCRM"
PseudoDualSimulations-class

This is a class which captures the trial simulations design using both the DLE and efficacy responses. The design of model from ModelTox class and the efficacy model from ModelEff class (except EffFlexi class). It contains all slots from GeneralSimulations and PseudoSimulations object. In comparison to the parent class PseudoSimulations, it contains additional slots to capture the dose-efficacy curve and the sigma2 estimates.
NextBestMTD-class

The class with the input for finding the next best MTD estimate
PseudoSimulationsSummary-class

Class for the summary of pseudo-models simulations output
Quantiles2LogisticNormal

Convert prior quantiles (lower, median, upper) to logistic (log) normal model
Samples

Initialization function for "Samples"
Stopping-class

The virtual class for stopping rules
RuleDesign

Initialization function for "RuleDesign"
Simulations-class

Class for the simulations output from model based designs
Samples-class

Class for the MCMC output
SimulationsSummary-class

Class for the summary of model-based simulations output
Simulations

Initialization function for the "Simulations" class
StoppingAll-class

Stop based on fullfillment of all multiple stopping rules
StoppingCohortsNearDose

Initialization function for "StoppingCohortsNearDose"
StoppingAny

Initialization function for "StoppingAny"
StoppingCohortsNearDose-class

Stop based on number of cohorts near to next best dose
Report

A Reference Class to represent sequentially updated reporting objects.
StoppingGstarCIRatio-class

Stop based on a target ratio, the ratio of the upper to the lower 95% credibility interval of the estimate of the minimum of the dose which gives the maximum gain (Gstar) and the TD end of trial, the dose with probability of DLE equals to the target probability of DLE used at the end of a trial.
StoppingMinPatients-class

Stop based on minimum number of patients
StoppingMinCohorts

Initialization function for "StoppingMinCohorts"
StoppingMTDdistribution-class

Stop based on MTD distribution
StoppingList

Initialization function for "StoppingList"
StoppingHighestDose

Initialization function for "StoppingHighestDose"
StoppingList-class

Stop based on multiple stopping rules
StoppingHighestDose-class

Stop when the highest dose is reached
PseudoSimulations-class

This is a class which captures the trial simulations from designs using pseudo model. The design for DLE only responses and model from ModelTox class object. It contains all slots from GeneralSimulations object. Additional slots fit and stopReasons compared to the general class GeneralSimulations.
StoppingMinPatients

Initialization function for "StoppingMinPatients"
StoppingPatientsNearDose-class

Stop based on number of patients near to next best dose
StoppingGstarCIRatio

Initialization function for "StoppingGstarCIRatio"
PseudoSimulations

Initialization function of the 'PseudoSimulations' class
StoppingAll

Initialization function for "StoppingAll"
StoppingTargetBiomarker-class

Stop based on probability of target biomarker
RuleDesign-class

Class for rule-based designs
StoppingTDCIRatio

Initialization function for "StoppingTDCIRatio"
StoppingPatientsNearDose

Initialization function for "StoppingPatientsNearDose"
approximate

Approximate posterior with (log) normal distribution
as.list,GeneralData-method

as.list method for the "GeneralData" class
StoppingMTDdistribution

Initialization function for "StoppingMTDdistribution"
StoppingAny-class

Stop based on fullfillment of any stopping rule
TDsamplesDesign

Initialization function for 'TDsamplesDesign' class
ThreePlusThreeDesign

Creates a new 3+3 design object from a dose grid
StoppingTargetProb-class

Stop based on probability of target tox interval
StoppingTargetBiomarker

Initialization function for "StoppingTargetBiomarker"
TDDesign-class

Design class using DLE responses only based on the pseudo DLE model without sample
StoppingTargetProb

Initialization function for "StoppingTargetProb"
StoppingMinCohorts-class

Stop based on minimum number of cohorts
&,Stopping,StoppingAll-method

The method combining an atomic and a stopping list
TDDesign

Initialization function for 'TDDesign' class
crmPackHelp

Open the browser with help pages for crmPack
crmPackExample

Open the example pdf for crmPack
fitGain

Get the fiited values for the gain values at all dose levels based on a given pseudo DLE model, DLE sample, a pseudo efficacy model, a Efficacy sample and data. This method returns a data frame with dose, middle, lower and upper quantiles of the gain value samples
TDsamplesDesign-class

This is a class of design based only on DLE responses using the 'LogisticIndepBeta' class model and DLE samples are also used. In addition to the slots in the more simple RuleDesign, objects of this class contain:
gain

Compute the gain value with a given dose level, given a pseudo DLE model, a DLE sample, a pseudo Efficacy log-log model and a Efficacy sample
examine

Obtain hypothetical trial course table for a design
&,StoppingAll,Stopping-method

The method combining a stopping list and an atomic
dose

Compute the doses for a given probability, given model and samples
dinvGamma

Compute the density of Inverse gamma distribution
fit

Fit method for the Samples class
initialize,DualEndpointOld-method

Initialization method for the "DualEndpointOld" class
getMinInfBeta

Get the minimal informative unimodal beta distribution
is.bool

Predicate checking for a boolean option
getResultList

Helper function to obtain simulation results list
is.probRange

Predicate checking for a probability range
is.wholenumber

checks for whole numbers (integers)
is.probability

Predicate checking for a probability
maxDose

Determine the maximum possible next dose
joinBodies

Helper function to join two function bodies
multiplot

Multiple plot function
minSize

"MIN" combination of cohort size rules
maxSize

"MAX" combination of cohort size rules
matchTolerance

Helper function for value matching with tolerance
Validate

A Reference Class to help programming validation for new S4 classes
mcmc

Obtain posterior samples for all model parameters
biomLevel

Compute the biomarker level for a given dose, given model and samples
is.range

Predicate checking for a numeric range
is.scalar

Checking for scalar
or-Stopping-StoppingAny

The method combining a stopping list and an atomic
joinModels

Helper function to join two BUGS models
or-Stopping-Stopping

The method combining two atomic stopping rules
noOverlap

Check overlap of two character vectors
StoppingTDCIRatio-class

Stop based on a target ratio, the ratio of the upper to the lower 95% credibility interval of the estimate of TD end of trial, the dose with probability of DLE equals to the target probability of DLE used at the end of a trial
or-StoppingAny-Stopping

The method combining an atomic and a stopping list
plot,Data,ModelTox-method

Plot of the fitted dose-tox based with a given pseudo DLE model and data without samples
&,Stopping,Stopping-method

The method combining two atomic stopping rules
logit

Shorthand for logit function
getEff

Extracting efficacy responses for subjects without or with a DLE. This is a class where we separate efficacy responses with or without a DLE. It outputs the efficacy responses and their corresponding dose levels treated at in two categories (with or without DLE)
get,Samples,character-method

Get specific parameter samples and produce a data.frame
myBarplot

Convenience function to make barplots of percentages
pinvGamma

Compute the distribution function of Inverse gamma distribution
crmPack-package

Object-oriented implementation of CRM designs
nextBest

Find the next best dose
plot,Data,missing-method

Plot method for the "Data" class
plot,GeneralSimulationsSummary,missing-method

Graphical display of the general simulation summary
plot,PseudoDualSimulationsSummary,missing-method

Plot the summary of Pseudo Dual Simulations summary
plot,PseudoSimulationsSummary,missing-method

Plot summaries of the pseudo simulations
plot,GeneralSimulations,missing-method

Plot simulations
myBayesLogit

Do MCMC sampling for Bayesian logistic regression model
plot,DualSimulationsSummary,missing-method

Plot summaries of the dual-endpoint design simulations
plot,DualSimulations,missing-method

Plot dual-endpoint simulations
plot,DataDual,missing-method

Plot method for the "DataDual" class
plot,DataDual,ModelEff-method

Plot of the fitted dose-efficacy based with a given pseudo efficacy model and data without samples
plot.gtable

Plots gtable objects
plot,SimulationsSummary,missing-method

Plot summaries of the model-based design simulations
plot,PseudoDualFlexiSimulations,missing-method

Plot for PseudoDualFlexiSimulations
plot,PseudoDualSimulations,missing-method

Plot simulations
printVignette

Taken from utils package (print.vignette)
prob

Compute the probability for a given dose, given model and samples
saveSample

Determine if we should save this sample
show,PseudoDualSimulationsSummary-method

Show the summary of Pseudo Dual simulations summary
show,GeneralSimulationsSummary-method

Show the summary of the simulations
sampleSize

Compute the number of samples for a given MCMC options triple
plot,Samples,ModelTox-method

Plot the fitted dose-DLE curve using a ModelTox class model with samples
plot,Samples,ModelEff-method

Plot the fitted dose-effcacy curve using a model from ModelEff class with samples
plot,Samples,DualEndpoint-method

Plotting dose-toxicity and dose-biomarker model fits
plot,Samples,Model-method

Plotting dose-toxicity model fits
rinvGamma

The random generation of the Inverse gamma distribution
plotDualResponses

Plot of the DLE and efficacy curve side by side given a DLE pseudo model, a DLE sample, an efficacy pseudo model and a given efficacy sample
show,DualSimulationsSummary-method

Show the summary of the dual-endpoint simulations
plotGain

Plot the gain curve in addition with the dose-DLE and dose-efficacy curve using a given DLE pseudo model, a DLE sample, a given efficacy pseudo model and an efficacy sample
setSeed

Helper function to set and save the RNG seed
safeInteger

Safe conversion to integer vector
qinvGamma

Compute the quantile function of Inverse gamma distribution
probit

Shorthand for probit function
simulate,TDDesign-method

This is a methods to simulate dose escalation procedure only using the DLE responses. This is a method based on the TDDesign where model used are of ModelTox class object and no samples are involved.
simulate,RuleDesign-method

Simulate outcomes from a rule-based design
simulate,DualResponsesDesign-method

This is a methods to simulate dose escalation procedure using both DLE and efficacy responses. This is a method based on the DualResponsesDesign where DLEmodel used are of ModelTox class object and efficacy model used are of ModelEff class object. In addition, no DLE and efficacy samples are involved or generated in the simulation process
show,SimulationsSummary-method

Show the summary of the simulations
show,PseudoSimulationsSummary-method

Show the summary of the simulations
simulate,Design-method

Simulate outcomes from a CRM design
simulate,DualDesign-method

Simulate outcomes from a dual-endpoint design
simulate,TDsamplesDesign-method

This is a methods to simulate dose escalation procedure only using the DLE responses. This is a method based on the TDsamplesDesign where model used are of ModelTox class object DLE samples are also used
size

Determine the size of the next cohort
summary,DualSimulations-method

Summarize the dual-endpoint design simulations, relative to given true dose-toxicity and dose-biomarker curves
stopTrial

Stop the trial?
summary,Simulations-method

Summarize the model-based design simulations, relative to a given truth
update,Data-method

Update method for the "Data" class
summary,PseudoSimulations-method

Summarize the simulations, relative to a given truth
summary,PseudoDualSimulations-method

Summary for Pseudo Dual responses simulations, relative to a given pseudo DLE and efficacy model (except the EffFlexi class model)
writeModel

Creating a WinBUGS model file
update,LogisticIndepBeta-method

Update method for the 'LogisticIndepBeta'Model class. This is a method to update the modal estimates of the model parameters \(\phi_1\) (phi1) and \(\phi_2\) (phi2) when new data or new observations of responses are available and added in.
summary,PseudoDualFlexiSimulations-method

Summary for Pseudo Dual responses simulations given a pseudo DLE model and the Flexible efficacy model.
summary,GeneralSimulations-method

Summarize the simulations, relative to a given truth
simulate,DualResponsesSamplesDesign-method

This is a methods to simulate dose escalation procedure using both DLE and efficacy responses. This is a method based on the DualResponsesSamplesDesign where DLEmodel used are of ModelTox class object and efficacy model used are of ModelEff class object (special case is EffFlexi class model object). In addition, DLE and efficacy samples are involved or generated in the simulation process
update,DataDual-method

Update method for the "DataDual" class
update,DataParts-method

Update method for the "DataParts" class
update,Effloglog-method

Update method for the 'Effloglog' Model class. This is a method to update the modal estimates of the model parameters \(\theta_1\) (theta1), \(\theta_2\) (theta2) and \(\nu\) (nu, the precision of the efficacy responses) when new data or new observations of responses are available and added in.
update,EffFlexi-method

Update method for the 'EffFlexi' Model class. This is a method to update estimates both for the flexible form model and the random walk model (see details in EffFlexi class object) when new data or new observations of responses are available and added in.