Learn R Programming

⚠️There's a newer version (1.0.6) 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

325

Version

1.0.0

License

GPL (>= 2)

Issues

Pull Requests

Stars

Forks

Maintainer

Giuseppe Palermo

Last Published

June 13th, 2019

Functions in crmPack (1.0.0)

AllModels-class

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

Size based on minimum of multiple cohort size rules
CohortSizeMax

Initialization function for "CohortSizeMax"
CohortSizeMax-class

Size based on maximum of multiple cohort size rules
DataMixture-class

Class for the data with mixture sharing
DataMixture

Initialization function for the "DataMixture" class
DualEndpointRW-class

Dual endpoint model with RW prior for biomarker
CohortSizeConst

Initialization function for "CohortSizeConst"
CohortSizeRange

Initialization function for "CohortSizeRange"
DualDesign

Initialization function for "DualDesign"
CohortSizeConst-class

Constant cohort size
DualEndpointOld-class

Dual endpoint model
DualDesign-class

Class for the dual-endpoint CRM design
EffFlexi-class

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

Cohort size based on dose range
EffFlexi

Initialization function for the "EffFlexi" class
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"
CohortSize-class

The virtual class for cohort sizes
CohortSizeMin

Initialization function for "CohortSizeMin"
CohortSizeParts

Initialization function for "CohortSizeParts"
DataDual-class

Class for the dual endpoint data input
CohortSizeDLT-class

Cohort size based on number of DLTs
CohortSizeDLT

Initialization function for "CohortSizeDLT"
DataDual

Initialization function for the "DataDual" class
LogisticKadane

Initialization function for the "LogisticKadane" class
DataParts

Initialization function for the "DataParts" class
DataParts-class

Class for the data with two study parts
CohortSizeParts-class

Cohort size based on the parts
IncrementsRelative

Initialization function for "IncrementsRelative"
Data-class

Class for the data input
IncrementMin

Initialization function for "IncrementMin"
LogisticLogNormalMixture-class

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

Initialization function for the "LogisticLogNormal" class
NextBestTD

Initialization function for the class "NextBestTD"
IncrementMin-class

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

The class with the input for finding the next best MTD estimate
NextBestDualEndpoint

Initialization function for "NextBestDualEndpoint"
DualEndpoint-class

General class for the dual endpoint model
NextBestTDsamples-class

Next best dose based on Pseudo DLE Model with samples
DualResponsesSamplesDesign

Initialization function for 'DualResponsesSamplesDesign"
Data

Initialization function for the "Data" class
Design-class

Class for the CRM design
DualSimulations-class

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

Initialization function for "Samples"
Simulations-class

Class for the simulations output from model based designs
Design

Initialization function for "Design"
DualEndpointBeta-class

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

Initialization function for the class 'NextBestMaxGain'
DualEndpointEmax-class

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

Initialization function for the "DualEndpointRW" class
DualEndpoint

Initialization function for the "DualEndpoint" class
DualSimulations

Initialization function for "DualSimulations"
DualSimulationsSummary-class

Class for the summary of dual-endpoint simulations output
StoppingCohortsNearDose

Initialization function for "StoppingCohortsNearDose"
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.
Effloglog-class

Class for the linear log-log efficacy model using pseudo data prior
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
StoppingMTDdistribution

Initialization function for "StoppingMTDdistribution"
LogisticLogNormal-class

Standard logistic model with bivariate (log) normal prior
IncrementsNumDoseLevels

Initialization function for "IncrementsNumDoseLevels"
LogisticLogNormalMixture

Initialization function for the "LogisticLogNormalMixture" class
GeneralSimulationsSummary-class

Class for the summary of general simulations output
GeneralSimulations

Initialization function for "GeneralSimulations"
LogisticIndepBeta

Intialization function for "LogisticIndepBeta" class
LogisticKadane-class

Reparametrized logistic model
Effloglog

Initialization function for the "Effloglog" class
LogisticLogNormalSub-class

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

Initialization function for the "LogisticNormalMixture" class
StoppingMinCohorts-class

Stop based on minimum number of cohorts
Simulations

Initialization function for the "Simulations" class
NextBestMaxGainSamples

Initialization function for class "NextBestMaxGainSamples"
NextBestNCRM-class

The class with the input for finding the next dose in target interval
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.
PseudoDualFlexiSimulations

Initialization function for 'PseudoDualFlexiSimulations' class
approximate

Approximate posterior with (log) normal distribution
examine

Obtain hypothetical trial course table for a design
as.list,GeneralData-method

as.list method for the "GeneralData" class
IncrementsRelative-class

Increments control based on relative differences in intervals
SimulationsSummary-class

Class for the summary of model-based simulations output
StoppingMinPatients

Initialization function for "StoppingMinPatients"
GeneralModel-class

No Intitialization function for this General class for model input
GeneralSimulations-class

General class for the simulations output
Increments-class

The virtual class for controlling increments
LogisticLogNormalSub

Initialization function for the "LogisticLogNormalSub" class
IncrementsNumDoseLevels-class

Increments control based on number of dose levels
is.scalar

Checking for scalar
is.range

Predicate checking for a numeric range
fit

Fit method for the Samples class
StoppingPatientsNearDose-class

Stop based on number of patients near to next best dose
LogisticNormal-class

Standard logistic model with bivariate normal prior
Model-class

Class for the model input
IncrementsRelativeParts

Initialization function for "IncrementsRelativeParts"
ModelEff-class

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

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

Initialization function for the "LogisticNormal" class
LogisticNormalFixedMixture-class

Standard logistic model with fixed mixture of multiple bivariate (log) normal priors
McmcOptions-class

Class for the three canonical MCMC options
NextBestNCRM

Initialization function for "NextBestNCRM"
McmcOptions

Initialization function for the "McmcOptions" class
NextBestTD-class

Next best dose based on Pseudo DLE model without sample
MinimalInformative

Construct a minimally informative prior
ModelPseudo-class

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

PseudoDualSimulations

Initialization function for 'DualPseudoSimulations' class
PseudoDualSimulationsSummary-class

Class for the summary of the dual responses simulations using pseudo models
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.
NextBestMTD

Initialization function for class "NextBestMTD"
PseudoSimulationsSummary-class

Class for the summary of pseudo-models simulations output
DualEndpointBeta

Initialization function for the "DualEndpointBeta" class
ExpEff

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

Initialization function for the "ProbitLogNormal" class
RuleDesign

Initialization function for "RuleDesign"
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.
NextBestMaxGain-class

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

Initialization function for "StoppingAll"
PseudoSimulations

Initialization function of the 'PseudoSimulations' class
StoppingAny-class

Stop based on fullfillment of any stopping rule
Validate

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

Determine the maximum possible next dose
matchTolerance

Helper function for value matching with tolerance
ProbitLogNormal-class

Probit model with bivariate log normal prior
NextBestThreePlusThree

Initialization function for "NextBestThreePlusThree"
dinvGamma

Compute the density of Inverse gamma distribution
dose

Compute the doses for a given probability, given model and samples
initialize,DualEndpointOld-method

Initialization method for the "DualEndpointOld" class
&,Stopping,Stopping-method

The method combining two atomic stopping rules
or-Stopping-Stopping

The method combining two atomic stopping rules
StoppingGstarCIRatio

Initialization function for "StoppingGstarCIRatio"
StoppingHighestDose-class

Stop when the highest dose is reached
DualEndpointEmax

Initialization function for the "DualEndpointEmax" class
StoppingTargetProb

Initialization function for "StoppingTargetProb"
Stopping-class

The virtual class for stopping rules
Report

A Reference Class to represent sequentially updated reporting objects.
is.bool

Predicate checking for a boolean option
ThreePlusThreeDesign

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

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

Class for rule-based designs
TDsamplesDesign

Initialization function for 'TDsamplesDesign' class
StoppingAll-class

Stop based on fullfillment of all multiple stopping rules
plot,PseudoDualFlexiSimulations,missing-method

This plot method can be applied to '>PseudoDualFlexiSimulations objects in order to summarize them graphically. Possible types of plots at the moment are:
trajectory

Summary of the trajectory of the simulated trials

dosesTried

Average proportions of the doses tested in patients

sigma2

The variance of the efficacy responses

sigma2betaW

The variance of the random walk model

You can specify one or both of these in the type argument.
or-Stopping-StoppingAny

The method combining a stopping list and an atomic
GeneralData-class

Class for general data input
StoppingTargetProb-class

Stop based on probability of target tox interval
plot,SimulationsSummary,missing-method

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

Plot simulations
plot.gtable

Plots gtable objects
StoppingMTDdistribution-class

Stop based on MTD distribution
StoppingList

Initialization function for "StoppingList"
StoppingPatientsNearDose

Initialization function for "StoppingPatientsNearDose"
or-StoppingAny-Stopping

The method combining an atomic and a stopping list
joinModels

Helper function to join two BUGS models
sampleSize

Compute the number of samples for a given MCMC options triple
logit

Shorthand for logit function
crmPackExample

Open the example pdf for crmPack
plot,DualSimulations,missing-method

Plot dual-endpoint simulations
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.
summary,PseudoDualSimulations-method

Summary for Pseudo Dual responses simulations, relative to a given pseudo DLE and efficacy model (except the EffFlexi class model)
plot,Samples,DualEndpoint-method

Plotting dose-toxicity and dose-biomarker model fits
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
plot,Samples,Model-method

Plotting dose-toxicity model fits
pinvGamma

Compute the distribution function of Inverse gamma distribution
plot,DualSimulationsSummary,missing-method

Plot summaries of the dual-endpoint design simulations
simulate,RuleDesign-method

Simulate outcomes from a rule-based design
saveSample

Determine if we should save this sample
TDsamplesDesign-class

TDDesign

Initialization function for 'TDDesign' class
biomLevel

Compute the biomarker level for a given dose, given model and samples
show,PseudoSimulationsSummary-method

Show the summary of the simulations
show,SimulationsSummary-method

Show the summary of the simulations
crmPackHelp

Open the browser with help pages for crmPack
is.wholenumber

checks for whole numbers (integers)
getMinInfBeta

Get the minimal informative unimodal beta distribution
getResultList

Helper function to obtain simulation results list
crmPack-package

Object-oriented implementation of CRM designs
Samples-class

Class for the MCMC output
plot,DataDual,missing-method

Plot method for the "DataDual" class
summary,PseudoSimulations-method

Summarize the simulations, relative to a given truth
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.
maxSize

"MAX" combination of cohort size rules
update,Data-method

Update method for the "Data" class
plot,DataDual,ModelEff-method

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

Helper function to join two function bodies
summary,Simulations-method

Summarize the model-based design simulations, relative to a given truth
writeModel

Creating a WinBUGS model file
IncrementsRelativeParts-class

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

Initialization function for the "LogisticNormalFixedMixture" class
StoppingAny

Initialization function for "StoppingAny"
size

Determine the size of the next cohort
qinvGamma

Compute the quantile function of Inverse gamma distribution
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
probit

Shorthand for probit function
summary,GeneralSimulations-method

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

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

IncrementsRelativeDLT

Initialization function for "IncrementsRelativeDLT"
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
mcmc

Obtain posterior samples for all model parameters
IncrementsRelativeDLT-class

Increments control based on relative differences in terms of DLTs
update,DataParts-method

Update method for the "DataParts" class
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
plot,Data,ModelTox-method

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

Plot method for the "Data" class
StoppingMinCohorts

Initialization function for "StoppingMinCohorts"
StoppingCohortsNearDose-class

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

Safe conversion to integer vector
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.
LogisticNormalMixture-class

Standard logistic model with flexible mixture of two bivariate normal priors
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
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
NextBestMaxGainSamples-class

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

Predicate checking for a probability range
NextBestDualEndpoint-class

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

Find the next best dose
StoppingMinPatients-class

Stop based on minimum number of patients
NextBestThreePlusThree-class

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

The virtual class for finding next best dose
StoppingTDCIRatio

Initialization function for "StoppingTDCIRatio"
NextBestTDsamples

Initialization function for class "NextBestTDsamples"
plot,GeneralSimulations,missing-method

Plot simulations
StoppingTargetBiomarker-class

Stop based on probability of target biomarker
&,Stopping,StoppingAll-method

The method combining an atomic and a stopping list
&,StoppingAll,Stopping-method

The method combining a stopping list and an atomic
StoppingTargetBiomarker

Initialization function for "StoppingTargetBiomarker"
Quantiles2LogisticNormal

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

Initialization function for "StoppingHighestDose"
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
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
StoppingList-class

Stop based on multiple stopping rules
noOverlap

Check overlap of two character vectors
printVignette

Taken from utils package (print.vignette)
get,Samples,character-method

Get specific parameter samples and produce a data.frame
simulate,Design-method

Simulate outcomes from a CRM design
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)
multiplot

Multiple plot function
myBarplot

Convenience function to make barplots of percentages
is.probability

Predicate checking for a probability
minSize

"MIN" combination of cohort size rules
show,DualSimulationsSummary-method

Show the summary of the dual-endpoint simulations
myBayesLogit

Do MCMC sampling for Bayesian logistic regression model
setSeed

Helper function to set and save the RNG seed
plot,GeneralSimulationsSummary,missing-method

Graphical display of the general simulation summary
plot,Samples,ModelEff-method

plot,PseudoSimulationsSummary,missing-method

Plot summaries of the pseudo simulations
show,GeneralSimulationsSummary-method

Show the summary of the simulations
plot,PseudoDualSimulationsSummary,missing-method

Plot the summary of Pseudo Dual Simulations summary
plot,Samples,ModelTox-method

Plot the fitted dose-DLE curve using a '>ModelTox class model with samples
show,PseudoDualSimulationsSummary-method

Show the summary of Pseudo Dual simulations summary
stopTrial

Stop the trial?
prob

Compute the probability for a given dose, given model and samples
simulate,DualDesign-method

Simulate outcomes from a dual-endpoint design
summary,DualSimulations-method

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