Learn R Programming

crmPack (version 2.0.1)

Object-Oriented Implementation of Dose Escalation Designs

Description

Implements a wide range of dose escalation designs. The focus is on model-based 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. Bayesian inference is performed via MCMC sampling in JAGS, and it is easy to setup a new design with custom 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. Further details are presented in Sabanes Bove et al. (2019) .

Copy Link

Version

Install

install.packages('crmPack')

Monthly Downloads

387

Version

2.0.1

License

GPL (>= 2)

Issues

Pull Requests

Stars

Forks

Maintainer

Daniel Sabanes Bove

Last Published

December 4th, 2025

Functions in crmPack (2.0.1)

DataDual-class

DataDual
DataDA-class

DataDA
DataGrouped-class

DataGrouped
DataParts-class

DataParts
DLTLikelihood

Likelihood of DLTs in each interval
DataMixture-class

DataMixture
DASimulations-class

DASimulations
DALogisticLogNormal-class

DALogisticLogNormal
DataOrdinal-class

DataOrdinal
Data-class

Data
DualResponsesDesign-class

DualResponsesDesign.R
DualEndpointRW-class

DualEndpointRW
Design-class

Design
DualEndpoint-class

DualEndpoint
DualDesign-class

DualDesign
DualEndpointEmax-class

DualEndpointEmax
DualEndpointBeta-class

DualEndpointBeta
DesignGrouped-class

DesignGrouped
DesignOrdinal-class

DesignOrdinal
DualResponsesSamplesDesign-class

DualResponsesSamplesDesign
DualSimulationsSummary-class

DualSimulationsSummary
GeneralSimulationsSummary-class

GeneralSimulationsSummary
Increments-class

Increments
EffFlexi-class

EffFlexi
GeneralSimulations-class

GeneralSimulations
GeneralModel-class

GeneralModel
Effloglog-class

Effloglog
LogisticIndepBeta-class

LogisticIndepBeta
FractionalCRM-class

FractionalCRM
DualSimulations-class

DualSimulations
GeneralData-class

GeneralData
IncrementsMaxToxProb-class

IncrementsMaxToxProb
IncrementsRelativeDLT-class

IncrementsRelativeDLT
IncrementsDoseLevels-class

IncrementsDoseLevels
IncrementsHSRBeta-class

IncrementsHSRBeta
IncrementsRelativeParts-class

IncrementsRelativeParts
IncrementsRelativeDLTCurrent-class

IncrementsRelativeDLTCurrent
IncrementsOrdinal-class

IncrementsOrdinal
IncrementsMin-class

IncrementsMin
IncrementsRelative-class

IncrementsRelative
LogisticNormalFixedMixture-class

LogisticNormalFixedMixture
LogisticKadane-class

LogisticKadane
LogisticLogNormalMixture-class

LogisticLogNormalMixture
LogisticKadaneBetaGamma-class

LogisticKadaneBetaGamma
LogisticLogNormalGrouped-class

LogisticLogNormalGrouped
LogisticLogNormalOrdinal-class

LogisticLogNormalOrdinal
LogisticLogNormal-class

LogisticLogNormal
LogisticLogNormalSub-class

LogisticLogNormalSub
LogisticNormalMixture-class

LogisticNormalMixture
LogisticNormal-class

LogisticNormal
ModelParamsNormal-class

ModelParamsNormal
ModelEff-class

ModelEff
NextBestDualEndpoint-class

NextBestDualEndpoint
McmcOptions-class

McmcOptions
ModelPseudo-class

ModelPseudo
NextBestMaxGainSamples-class

NextBestMaxGainSamples
ModelLogNormal-class

ModelLogNormal
NextBestMaxGain-class

NextBestMaxGain
NextBestNCRMLoss-class

NextBestNCRMLoss
NextBestEWOC-class

NextBestEWOC
NextBestOrdinal-class

NextBestOrdinal
NextBestProbMTDLTE-class

NextBestProbMTDLTE
ModelTox-class

ModelTox
NextBest-class

NextBest
NextBestProbMTDMinDist-class

NextBestProbMTDMinDist
NextBestInfTheory-class

NextBestInfTheory
NextBestMTD-class

NextBestMTD
NextBestThreePlusThree-class

NextBestThreePlusThree
OneParLogNormalPrior-class

OneParLogNormalPrior
NextBestTD-class

NextBestTD
PseudoDualSimulationsSummary-class

PseudoDualSimulationsSummary
ProbitLogNormal-class

ProbitLogNormal
ProbitLogNormalRel-class

ProbitLogNormalRel
NextBestNCRM-class

NextBestNCRM
NextBestTDsamples-class

NextBestTDsamples
PseudoDualFlexiSimulations-class

PseudoDualFlexiSimulations
PseudoDualSimulations-class

PseudoDualSimulations
NextBestMinDist-class

NextBestMinDist
MinimalInformative

Construct a Minimally Informative Prior
OneParExpPrior-class

OneParExpPrior
Quantiles2LogisticNormal

Convert Prior Quantiles to Logistic (Log) Normal Model
RuleDesign-class

RuleDesign
PseudoSimulationsSummary-class

PseudoSimulationsSummary
PseudoSimulations-class

PseudoSimulations
Simulations-class

Simulations
Samples-class

Samples
Stopping-class

Stopping
RuleDesignOrdinal-class

RuleDesignOrdinal
SafetyWindow-class

SafetyWindow
StoppingAny-class

StoppingAny
StoppingCohortsNearDose-class

StoppingCohortsNearDose
StoppingAll-class

StoppingAll
StoppingExternal-class

StoppingExternal
StoppingHighestDose-class

StoppingHighestDose
SimulationsSummary-class

SimulationsSummary
StartingDose-class

StartingDose
StoppingMissingDose-class

StoppingMissingDose
SafetyWindowSize-class

SafetyWindowSize
SafetyWindowConst-class

SafetyWindowConst
StoppingMinPatients-class

StoppingMinPatients
StoppingPatientsNearDose-class

StoppingPatientsNearDose
StoppingOrdinal-class

StoppingOrdinal
StoppingMinCohorts-class

StoppingMinCohorts
StoppingMaxGainCIRatio-class

StoppingMaxGainCIRatio
Validate

Validate
TITELogisticLogNormal-class

TITELogisticLogNormal
&,Stopping,Stopping-method

Combine Two Stopping Rules with AND
StoppingLowestDoseHSRBeta-class

StoppingLowestDoseHSRBeta
StoppingList-class

StoppingList
StoppingSpecificDose-class

StoppingSpecificDose
StoppingTDCIRatio-class

StoppingTDCIRatio
&,Stopping,StoppingAll-method

Combine an Atomic Stopping Rule and a Stopping List with AND
StoppingTargetBiomarker-class

StoppingTargetBiomarker
StoppingTargetProb-class

StoppingTargetProb
StoppingMTDCV-class

StoppingMTDCV
&,StoppingAll,Stopping-method

Combine a Stopping List and an Atomic Stopping Rule with AND
check_probability

Check if an argument is a single probability value
check_probability_range

Check if an argument is a probability range
biomarker

Get the Biomarker Levels for a Given Dual-Endpoint Model, Given Dose Levels and Samples
assertions

Additional Assertions for checkmate
check_range

Check that an argument is a numerical range
approximate

Approximate posterior with (log) normal distribution
StoppingMTDdistribution-class

StoppingMTDdistribution
TDDesign-class

TDDesign
crmPack

Object-oriented implementation of CRM designs
check_length

Check if vectors are of compatible lengths
check_probabilities

Check if an argument is a probability vector
crmPackHelp

Open the Browser with Help Pages for crmPack
crmPackExample

Open the Example PDF for crmPack
TDsamplesDesign-class

TDsamplesDesign
enable_logging

Verbose Logging
gain

Compute Gain Values based on Pseudo DLE and a Pseudo Efficacy Models and Using Optional Samples.
efficacyFunction

Getting the Efficacy Function for a Given Model Type
fitGain

Get the fitted 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
dapply

Apply a Function to Subsets of Data Frame.
dinvGamma

Compute the Density of Inverse Gamma Distribution
get,Samples,character-method

Get specific parameter samples and produce a data.frame
fitPEM

Get the fitted DLT free survival (piecewise exponential model). This function returns a data frame with dose, middle, lower and upper quantiles for the PEM curve. If hazard=TRUE,
h_default_if_empty

Getting the default value for an empty object
efficacy

Computing Expected Efficacy for a Given Dose, Model and Samples
dose_grid_range

Getting the Dose Grid Range
h_determine_dlts

Helper function to determine the dlts including first separate and placebo condition
h_covr_helpers

Helpers for stripping expressions of covr-inserted trace code
h_get_min_inf_beta

Helper for Minimal Informative Unimodal Beta Distribution
h_blind_plot_data

Helper Function to Blind Plot Data
h_model_dual_endpoint_beta

Update certain components of DualEndpoint model with regard to parameters of the function that models dose-biomarker relationship defined in the DualEndpointBeta class.
h_knit_format_func

Used to obtain expected format.
getEff

Extracting Efficacy Responses for Subjects Categorized by the DLT
h_get_quantiles_start_values

Get Starting Values for Quantiles Optimization
h_next_best_eligible_doses

Get Eligible Doses from the Dose Grid.
h_model_dual_endpoint_sigma2w

Update DualEndpoint class model components with regard to biomarker regression variance.
h_next_best_mg_doses_at_grid

Get Closest Grid Doses for a Given Target Doses for nextBest-NextBestMaxGain Method.
h_model_dual_endpoint_rho

Update DualEndpoint class model components with regard to DLT and biomarker correlation.
h_next_best_mg_ci

Credibility Intervals for Max Gain and Target Doses at nextBest-NextBestMaxGain Method.
h_jags_extract_samples

Extracting Samples from JAGS mcarray Object
h_calc_report_label_percentage

Helper function to calculate percentage of true stopping rules for report label output calculates true column means and converts output into percentages before combining the output with the report label; output is passed to show() and output with cat to console
h_jags_add_dummy

Appending a Dummy Number for Selected Slots in Data
h_model_dual_endpoint_sigma2betaw

Update certain components of DualEndpoint model with regard to prior variance factor of the random walk.
h_obtain_dose_grid_range

Helper Function Containing Common Functionality
h_all_equivalent

Comparison with Numerical Tolerance and Without Name Comparison
h_simulations_output_format

Helper Function to create return list for Simulations output
h_plot_data_cohort_lines

Preparing Cohort Lines for Data Plot
h_rapply

Recursively Apply a Function to a List
h_barplot_percentages

Convenience function to make barplots of percentages
h_prepare_labels

Check That Labels Are Valid and Useful
h_plot_simulation_trajectory

Helper Function to Create Trajectory Plot
h_next_best_mg_plot

Building the Plot for nextBest-NextBestMaxGain Method.
h_info_theory_dist

Calculating the Information Theoretic Distance
h_next_best_mgsamples_plot

Building the Plot for nextBest-NextBestMaxGainSamples Method.
h_find_interval

Find Interval Numbers or Indices and Return Custom Number For 0.
h_jags_write_model

Writing JAGS Model to a File
check_format

Check that an argument is a valid format specification
h_jags_join_models

Joining JAGS Models
dose

Computing the Doses for a given independent variable, Model and Samples
h_is_positive_definite

Testing Matrix for Positive Definiteness
check_equal

Check if All Arguments Are Equal
h_test_named_numeric

Check that an argument is a named vector of type numeric
get_result_list

Helper Function to Obtain Simulation Results List
h_next_best_tdsamples_plot

Building the Plot for nextBest-NextBestTDsamples Method.
h_quantiles_target_function

Target Function for Quantiles Optimization
h_validate_common_data_slots

Helper Function performing validation Common to Data and DataOrdinal
h_slots

Getting the Slots from a S4 Object
h_summarize_add_stats

Helper function to calculate average across iterations for each additional reporting parameter extracts parameter names as specified by user and averaged the values for each specified parameter to show() and output with cat to console
h_pseudo_sim_inverse_dose

Helper Function to Calculate Inverse Dose
h_unpack_stopit

Helper function to recursively unpack stopping rules and return lists with logical value and label given
h_convert_ordinal_model

Convert an ordinal CRM model to the Equivalent Binary CRM Model for a Specific Grade
h_convert_ordinal_samples

Convert a Samples Object from an ordinal Model to the Equivalent Samples Object from a Binary Model
h_group_data

Group Together Mono and Combo Data
h_plot_data_df

Preparing Data for Plotting
doseFunction

Getting the Dose Function for a Given Model Type
h_this_truth

Helper Function to call truth calculation
minSize

"MIN" Combination of Cohort Size Rules
mcmc

Obtaining Posterior Samples for all Model Parameters
nextBest

Finding the Next Best Dose
knit_print

Render a CohortSizeConst Object
h_get_formatted_dosegrid

Format a doseGrid for Printing
h_next_best_ncrm_loss_plot

Building the Plot for nextBest-NextBestNCRMLoss Method.
or-Stopping-Stopping

Combine Two Stopping Rules with OR
ngrid

Number of Doses in Grid
h_validate_combine_results

Combining S4 Class Validation Results
or-Stopping-StoppingAny

Combine an Atomic Stopping Rule and a Stopping List with OR
examine

Obtain Hypothetical Trial Course Table for a Design
h_in_range

Check which elements are in a given range
fit

Fit method for the Samples class
h_null_if_na

Getting NULL for NA
h_prepare_units

Append Units to a Numeric Dose
match_within_tolerance

Helper Function for Value Matching with Tolerance
logit

Shorthand for Logit Function
names,Samples-method

The Names of the Sampled Parameters
h_check_fun_formals

Checking Formals of a Function
h_convert_ordinal_data

Convert a Ordinal Data to the Equivalent Binary Data for a Specific Grade
h_jags_get_data

Getting Data for JAGS
h_format_number

Conditional Formatting Using C-style Formats
myBayesLogit

MCMC Sampling for Bayesian Logistic Regression Model
h_pseudo_sim_fit_summary

Helper Function to Calculate Fit Summary
plot,DualSimulationsSummary,missing-method

Plot Dual-Endpoint Design Simulation Summary
plot,DualSimulations,missing-method

Plot DualSimulations
h_plot_data_dataordinal

Helper Function for the Plot Method of the Data and DataOrdinal Classes
or-StoppingAny-Stopping

Combine a Stopping List and an Atomic Stopping Rule with OR
maxDose

Determine the Maximum Possible Next Dose
h_jags_get_model_inits

Setting Initial Values for JAGS Model Parameters
plot,Samples,DualEndpoint-method

Plotting dose-toxicity and dose-biomarker model fits
%>%

Pipe operator
plot,Samples,DALogisticLogNormal-method

Plotting dose-toxicity model fits
plot,PseudoSimulationsSummary,missing-method

Plot PseudoSimulationsSummary
plot,PseudoDualSimulationsSummary,missing-method

Plot PseudoDualSimulationsSummary
plot,Samples,GeneralModel-method

Plotting dose-toxicity model fits
pinvGamma

Compute the Distribution Function of Inverse Gamma Distribution
plot,Data,ModelTox-method

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

Plot PseudoDualFlexiSimulations
plot,DataDA,missing-method

Plot Method for the DataDA Class
plot,PseudoDualSimulations,missing-method

Plot PseudoDualSimulations
prob

Computing Toxicity Probabilities for a Given Dose, Model and Samples
plot,Samples,ModelEff-method

Plot the fitted dose-efficacy curve using a model from ModelEff class with samples
plot,GeneralSimulations,missing-method

Plot GeneralSimulations
h_next_best_td_plot

Building the Plot for nextBest-NextBestTD Method.
probit

Shorthand for Probit Function
probFunction

Getting the Prob Function for a Given Model Type
maxSize

"MAX" Combination of Cohort Size Rules
plot,DataDual,missing-method

Plot Method for the DataDual Class
printVignette

Print Vignette
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
h_plot_doses_tried

Helper Function to Create Doses Tried Plot
plot,DataDual,ModelEff-method

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

positive_number
plot,Samples,ModelTox-method

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

Plot Model-Based Design Simulation Summary
show,DualSimulationsSummary-method

Show the Summary of Dual-Endpoint Simulations
plot,GeneralSimulationsSummary,missing-method

Plot GeneralSimulationsSummary
show,SimulationsSummary-method

Show the Summary of Model-Based Design Simulations
qinvGamma

Compute the Quantile Function of Inverse Gamma Distribution
simulate,DADesign-method

Simulate outcomes from a time-to-DLT augmented CRM design
saveSample

Determining if this Sample Should be Saved
set_seed

Helper Function to Set and Save the RNG Seed
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
plot.gtable

Plot gtable Objects
show,PseudoDualSimulationsSummary-method

Show the Summary of PseudoDualSimulations
rinvGamma

Random Generation for the Inverse Gamma Distribution
show,PseudoSimulationsSummary-method

Show the Summary of PseudoSimulations
show,GeneralSimulationsSummary-method

Show the Summary of the Simulations
simulate,DualDesign-method

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

Simulate dose escalation procedure using DLE responses only with DLE samples
simulate,TDDesign-method

Simulate dose escalation procedure using DLE responses only without samples
simulate,Design-method

Simulate outcomes from a CRM design
stopTrial

Stop the trial?
simulate,DualResponsesDesign-method

Simulate dose escalation procedure using both DLE and efficacy responses without samples
simulate,DesignGrouped-method

Simulate Method for the DesignGrouped Class
simulate,DualResponsesSamplesDesign-method

Simulate dose escalation procedure using DLE and efficacy responses with samples
simulate,RuleDesign-method

Simulate outcomes from a rule-based design
size

Size of an Object
summary,DualSimulations-method

Summarize Dual-Endpoint Design Simulations
summary,GeneralSimulations-method

Summarize the GeneralSimulations, Relative to a Given Truth
summary,PseudoDualFlexiSimulations-method

Summarize PseudoDualFlexiSimulations
summary,PseudoDualSimulations-method

Summarize PseudoDualSimulations
tidy

Tidying CrmPackClass objects
update,Data-method

Updating Data Objects
summary,Simulations-method

Summarize Model-Based Design Simulations
summary,PseudoSimulations-method

Summarize PseudoSimulations
update,DataDA-method

Updating DataDA Objects
update,DataDual-method

Updating DataDual Objects
v_mcmcoptions_objects

Internal Helper Functions for Validation of McmcOptions Objects
v_increments

Internal Helper Functions for Validation of Increments Objects
update,DataParts-method

Updating DataParts Objects
v_cohort_size

Internal Helper Functions for Validation of CohortSize Objects
v_model_objects

Internal Helper Functions for Validation of GeneralModel and ModelPseudo Objects
v_general_simulations

Internal Helper Functions for Validation of GeneralSimulations Objects
v_design

Internal Helper Functions for Validation of RuleDesign Objects
update,ModelPseudo-method

Update method for the ModelPseudo model class. This is a method to update the model class slots (estimates, parameters, variables and etc.), when the new data (e.g. new observations of responses) are available. This method is mostly used to obtain new modal estimates for pseudo model parameters.
v_data_objects

Internal Helper Functions for Validation of GeneralData Objects
update,DataOrdinal-method

Updating DataOrdinal Objects
v_stopping

Internal Helper Functions for Validation of Stopping Objects
v_starting_dose

Internal Helper Functions for Validation of StartingDose Objects
v_samples_objects

Internal Helper Functions for Validation of Samples Objects
windowLength

Determine the Safety Window Length of the Next Cohort
v_safety_window

Internal Helper Functions for Validation of SafetyWindow Objects
v_model_params

Internal Helper Functions for Validation of Model Parameters Objects
v_pseudo_simulations

Internal Helper Functions for Validation of PseudoSimulations Objects
v_next_best

Internal Helper Functions for Validation of NextBest Objects
CrmPackClass-class

CrmPackClass
CohortSizeDLT-class

CohortSizeDLT
CohortSizeOrdinal-class

CohortSizeOrdinal
CohortSizeMin-class

CohortSizeMin
CohortSizeParts-class

CohortSizeParts
.DefaultCohortSize

CohortSize
DADesign-class

DADesign
CohortSizeRange-class

CohortSizeRange
CohortSizeMax-class

CohortSizeMax
CohortSizeConst-class

CohortSizeConst