Learn R Programming

crmPack (version 2.0.0)

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

353

Version

2.0.0

License

GPL (>= 2)

Issues

Pull Requests

Stars

Forks

Maintainer

Daniel Sabanes Bove

Last Published

November 29th, 2025

Functions in crmPack (2.0.0)

DataOrdinal-class

DataOrdinal
DataParts-class

DataParts
DASimulations-class

DASimulations
DALogisticLogNormal-class

DALogisticLogNormal
Data-class

Data
DataDA-class

DataDA
DLTLikelihood

Likelihood of DLTs in each interval
DataDual-class

DataDual
DataGrouped-class

DataGrouped
DataMixture-class

DataMixture
DualResponsesDesign-class

DualResponsesDesign.R
Design-class

Design
DualResponsesSamplesDesign-class

DualResponsesSamplesDesign
DualEndpoint-class

DualEndpoint
DualEndpointBeta-class

DualEndpointBeta
DesignOrdinal-class

DesignOrdinal
DualDesign-class

DualDesign
DesignGrouped-class

DesignGrouped
DualEndpointRW-class

DualEndpointRW
DualEndpointEmax-class

DualEndpointEmax
FractionalCRM-class

FractionalCRM
GeneralData-class

GeneralData
GeneralSimulationsSummary-class

GeneralSimulationsSummary
Increments-class

Increments
EffFlexi-class

EffFlexi
GeneralSimulations-class

GeneralSimulations
DualSimulationsSummary-class

DualSimulationsSummary
DualSimulations-class

DualSimulations
GeneralModel-class

GeneralModel
Effloglog-class

Effloglog
IncrementsDoseLevels-class

IncrementsDoseLevels
IncrementsRelativeParts-class

IncrementsRelativeParts
IncrementsOrdinal-class

IncrementsOrdinal
IncrementsHSRBeta-class

IncrementsHSRBeta
IncrementsMin-class

IncrementsMin
IncrementsMaxToxProb-class

IncrementsMaxToxProb
LogisticLogNormalOrdinal-class

LogisticLogNormalOrdinal
LogisticLogNormalMixture-class

LogisticLogNormalMixture
LogisticIndepBeta-class

LogisticIndepBeta
LogisticKadaneBetaGamma-class

LogisticKadaneBetaGamma
LogisticKadane-class

LogisticKadane
IncrementsRelative-class

IncrementsRelative
IncrementsRelativeDLTCurrent-class

IncrementsRelativeDLTCurrent
LogisticNormalFixedMixture-class

LogisticNormalFixedMixture
LogisticNormalMixture-class

LogisticNormalMixture
IncrementsRelativeDLT-class

IncrementsRelativeDLT
ModelTox-class

ModelTox
ModelParamsNormal-class

ModelParamsNormal
LogisticLogNormalSub-class

LogisticLogNormalSub
LogisticNormal-class

LogisticNormal
ModelPseudo-class

ModelPseudo
LogisticLogNormal-class

LogisticLogNormal
McmcOptions-class

McmcOptions
LogisticLogNormalGrouped-class

LogisticLogNormalGrouped
NextBestProbMTDLTE-class

NextBestProbMTDLTE
NextBestInfTheory-class

NextBestInfTheory
MinimalInformative

Construct a Minimally Informative Prior
NextBestEWOC-class

NextBestEWOC
NextBestDualEndpoint-class

NextBestDualEndpoint
ModelLogNormal-class

ModelLogNormal
ModelEff-class

ModelEff
NextBestMaxGain-class

NextBestMaxGain
NextBestMaxGainSamples-class

NextBestMaxGainSamples
NextBestMTD-class

NextBestMTD
NextBestOrdinal-class

NextBestOrdinal
NextBestNCRMLoss-class

NextBestNCRMLoss
NextBest-class

NextBest
PseudoDualSimulations-class

PseudoDualSimulations
NextBestThreePlusThree-class

NextBestThreePlusThree
PseudoDualSimulationsSummary-class

PseudoDualSimulationsSummary
OneParLogNormalPrior-class

OneParLogNormalPrior
NextBestMinDist-class

NextBestMinDist
NextBestTD-class

NextBestTD
NextBestNCRM-class

NextBestNCRM
NextBestProbMTDMinDist-class

NextBestProbMTDMinDist
Samples-class

Samples
NextBestTDsamples-class

NextBestTDsamples
PseudoSimulationsSummary-class

PseudoSimulationsSummary
PseudoSimulations-class

PseudoSimulations
ProbitLogNormal-class

ProbitLogNormal
SafetyWindowConst-class

SafetyWindowConst
SafetyWindowSize-class

SafetyWindowSize
OneParExpPrior-class

OneParExpPrior
RuleDesignOrdinal-class

RuleDesignOrdinal
Quantiles2LogisticNormal

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

ProbitLogNormalRel
RuleDesign-class

RuleDesign
PseudoDualFlexiSimulations-class

PseudoDualFlexiSimulations
Simulations-class

Simulations
StoppingLowestDoseHSRBeta-class

StoppingLowestDoseHSRBeta
StoppingList-class

StoppingList
StoppingAny-class

StoppingAny
StoppingMTDCV-class

StoppingMTDCV
StoppingMTDdistribution-class

StoppingMTDdistribution
StoppingExternal-class

StoppingExternal
StoppingHighestDose-class

StoppingHighestDose
StoppingCohortsNearDose-class

StoppingCohortsNearDose
StoppingMaxGainCIRatio-class

StoppingMaxGainCIRatio
StoppingMinCohorts-class

StoppingMinCohorts
SafetyWindow-class

SafetyWindow
SimulationsSummary-class

SimulationsSummary
StartingDose-class

StartingDose
StoppingAll-class

StoppingAll
Stopping-class

Stopping
&,StoppingAll,Stopping-method

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

TDDesign
StoppingMinPatients-class

StoppingMinPatients
TDsamplesDesign-class

TDsamplesDesign
StoppingMissingDose-class

StoppingMissingDose
check_equal

Check if All Arguments Are Equal
StoppingTargetBiomarker-class

StoppingTargetBiomarker
StoppingTargetProb-class

StoppingTargetProb
StoppingTDCIRatio-class

StoppingTDCIRatio
StoppingSpecificDose-class

StoppingSpecificDose
check_format

Check that an argument is a valid format specification
check_range

Check that an argument is a numerical range
crmPack

Object-oriented implementation of CRM designs
StoppingPatientsNearDose-class

StoppingPatientsNearDose
&,Stopping,StoppingAll-method

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

StoppingOrdinal
&,Stopping,Stopping-method

Combine Two Stopping Rules with AND
check_length

Check if vectors are of compatible lengths
check_probabilities

Check if an argument is a probability vector
assertions

Additional Assertions for checkmate
approximate

Approximate posterior with (log) normal distribution
check_probability

Check if an argument is a single probability value
dose

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

Validate
TITELogisticLogNormal-class

TITELogisticLogNormal
doseFunction

Getting the Dose Function for a Given Model Type
getEff

Extracting Efficacy Responses for Subjects Categorized by the DLT
h_all_equivalent

Comparison with Numerical Tolerance and Without Name Comparison
h_barplot_percentages

Convenience function to make barplots of percentages
check_probability_range

Check if an argument is a probability range
dapply

Apply a Function to Subsets of Data Frame.
dinvGamma

Compute the Density of Inverse Gamma Distribution
efficacyFunction

Getting the Efficacy Function for a Given Model Type
biomarker

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

Obtain Hypothetical Trial Course Table for a Design
get_result_list

Helper Function to Obtain Simulation Results List
dose_grid_range

Getting the Dose Grid Range
h_default_if_empty

Getting the default value for an empty object
h_covr_helpers

Helpers for stripping expressions of covr-inserted trace code
h_convert_ordinal_model

Convert an ordinal CRM model to the Equivalent Binary CRM Model for a Specific Grade
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_convert_ordinal_samples

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

Verbose Logging
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
h_info_theory_dist

Calculating the Information Theoretic Distance
h_format_number

Conditional Formatting Using C-style Formats
h_find_interval

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

Fit method for the Samples class
h_blind_plot_data

Helper Function to Blind Plot Data
efficacy

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

Open the Browser with Help Pages for crmPack
gain

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

Format a doseGrid for Printing
get,Samples,character-method

Get specific parameter samples and produce a data.frame
h_determine_dlts

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

Open the Example PDF for crmPack
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_in_range

Check which elements are in a given range
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_get_data

Getting Data for JAGS
h_group_data

Group Together Mono and Combo 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_is_positive_definite

Testing Matrix for Positive Definiteness
h_knit_format_func

Used to obtain expected format.
h_model_dual_endpoint_rho

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

Helper for Minimal Informative Unimodal Beta Distribution
h_jags_join_models

Joining JAGS Models
h_jags_write_model

Writing JAGS Model to a File
h_obtain_dose_grid_range

Helper Function Containing Common Functionality
h_get_quantiles_start_values

Get Starting Values for Quantiles Optimization
h_jags_get_model_inits

Setting Initial Values for JAGS Model Parameters
h_model_dual_endpoint_sigma2betaw

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

Building the Plot for nextBest-NextBestMaxGain Method.
h_model_dual_endpoint_sigma2w

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

Appending a Dummy Number for Selected Slots in Data
h_jags_extract_samples

Extracting Samples from JAGS mcarray Object
h_pseudo_sim_inverse_dose

Helper Function to Calculate Inverse Dose
h_next_best_mgsamples_plot

Building the Plot for nextBest-NextBestMaxGainSamples Method.
h_rapply

Recursively Apply a Function to a List
h_simulations_output_format

Helper Function to create return list for Simulations output
h_next_best_mg_ci

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

Getting NULL for NA
h_next_best_tdsamples_plot

Building the Plot for nextBest-NextBestTDsamples Method.
h_next_best_mg_doses_at_grid

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

Helper Function to Calculate Fit Summary
h_next_best_ncrm_loss_plot

Building the Plot for nextBest-NextBestNCRMLoss Method.
h_next_best_eligible_doses

Get Eligible Doses from the Dose Grid.
h_prepare_units

Append Units to a Numeric Dose
h_quantiles_target_function

Target Function for Quantiles Optimization
h_plot_doses_tried

Helper Function to Create Doses Tried Plot
h_next_best_td_plot

Building the Plot for nextBest-NextBestTD Method.
h_plot_data_df

Preparing Data for Plotting
h_plot_data_cohort_lines

Preparing Cohort Lines for Data Plot
h_prepare_labels

Check That Labels Are Valid and Useful
h_plot_simulation_trajectory

Helper Function to Create Trajectory Plot
h_test_named_numeric

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

Render a CohortSizeConst Object
h_validate_common_data_slots

Helper Function performing validation Common to Data and DataOrdinal
h_this_truth

Helper Function to call truth calculation
logit

Shorthand for Logit Function
match_within_tolerance

Helper Function for Value Matching with Tolerance
h_unpack_stopit

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

Combining S4 Class Validation Results
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_slots

Getting the Slots from a S4 Object
names,Samples-method

The Names of the Sampled Parameters
minSize

"MIN" Combination of Cohort Size Rules
nextBest

Finding the Next Best Dose
myBayesLogit

MCMC Sampling for Bayesian Logistic Regression Model
mcmc

Obtaining Posterior Samples for all Model Parameters
ngrid

Number of Doses in Grid
or-Stopping-Stopping

Combine Two Stopping Rules with OR
or-Stopping-StoppingAny

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

"MAX" Combination of Cohort Size Rules
maxDose

Determine the Maximum Possible Next Dose
plot,DataDual,missing-method

Plot Method for the DataDual Class
plot,DualSimulationsSummary,missing-method

Plot Dual-Endpoint Design Simulation Summary
plot,DataDual,ModelEff-method

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

Plot Method for the DataDA Class
h_plot_data_dataordinal

Helper Function for the Plot Method of the Data and DataOrdinal Classes
plot,DualSimulations,missing-method

Plot DualSimulations
%>%

Pipe operator
or-StoppingAny-Stopping

Combine a Stopping List and an Atomic Stopping Rule with OR
plot,Samples,DALogisticLogNormal-method

Plotting dose-toxicity model fits
plot,Samples,GeneralModel-method

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

Plot PseudoDualSimulationsSummary
plot,Data,ModelTox-method

Plot of the fitted dose-tox based with a given pseudo DLE model and data without samples
pinvGamma

Compute the Distribution Function of Inverse Gamma Distribution
plot,Samples,ModelEff-method

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

Plot GeneralSimulationsSummary
plot,GeneralSimulations,missing-method

Plot GeneralSimulations
plot,PseudoDualSimulations,missing-method

Plot PseudoDualSimulations
plot,PseudoDualFlexiSimulations,missing-method

Plot PseudoDualFlexiSimulations
printVignette

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

Getting the Prob Function for a Given Model Type
plot.gtable

Plot gtable Objects
plot,Samples,DualEndpoint-method

Plotting dose-toxicity and dose-biomarker model fits
probit

Shorthand for Probit Function
prob

Computing Toxicity Probabilities for a Given Dose, Model and Samples
set_seed

Helper Function to Set and Save the RNG Seed
qinvGamma

Compute the Quantile Function of Inverse Gamma Distribution
saveSample

Determining if this Sample Should be Saved
rinvGamma

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

Show the Summary of Model-Based Design Simulations
plot,SimulationsSummary,missing-method

Plot Model-Based Design Simulation Summary
simulate,DADesign-method

Simulate outcomes from a time-to-DLT augmented CRM design
plot,Samples,ModelTox-method

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

Show the Summary of PseudoDualSimulations
plot,PseudoSimulationsSummary,missing-method

Plot PseudoSimulationsSummary
positive_number

positive_number
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
show,PseudoSimulationsSummary-method

Show the Summary of PseudoSimulations
show,GeneralSimulationsSummary-method

Show the Summary of the Simulations
show,DualSimulationsSummary-method

Show the Summary of Dual-Endpoint Simulations
stopTrial

Stop the trial?
simulate,TDDesign-method

Simulate dose escalation procedure using DLE responses only without samples
size

Size of an Object
simulate,TDsamplesDesign-method

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

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

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

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

Simulate outcomes from a rule-based design
summary,PseudoSimulations-method

Summarize PseudoSimulations
summary,Simulations-method

Summarize Model-Based Design Simulations
simulate,DesignGrouped-method

Simulate Method for the DesignGrouped Class
update,DataDA-method

Updating DataDA Objects
simulate,Design-method

Simulate outcomes from a CRM design
summary,PseudoDualFlexiSimulations-method

Summarize PseudoDualFlexiSimulations
summary,PseudoDualSimulations-method

Summarize PseudoDualSimulations
update,DataDual-method

Updating DataDual Objects
update,DataParts-method

Updating DataParts Objects
update,DataOrdinal-method

Updating DataOrdinal Objects
v_general_simulations

Internal Helper Functions for Validation of GeneralSimulations Objects
v_increments

Internal Helper Functions for Validation of Increments Objects
v_pseudo_simulations

Internal Helper Functions for Validation of PseudoSimulations Objects
v_design

Internal Helper Functions for Validation of RuleDesign Objects
v_starting_dose

Internal Helper Functions for Validation of StartingDose Objects
v_samples_objects

Internal Helper Functions for Validation of Samples Objects
v_data_objects

Internal Helper Functions for Validation of GeneralData Objects
v_safety_window

Internal Helper Functions for Validation of SafetyWindow Objects
v_model_params

Internal Helper Functions for Validation of Model Parameters Objects
v_next_best

Internal Helper Functions for Validation of NextBest Objects
summary,DualSimulations-method

Summarize Dual-Endpoint Design Simulations
v_model_objects

Internal Helper Functions for Validation of GeneralModel and ModelPseudo Objects
summary,GeneralSimulations-method

Summarize the GeneralSimulations, Relative to a Given Truth
v_mcmcoptions_objects

Internal Helper Functions for Validation of McmcOptions Objects
tidy

Tidying CrmPackClass objects
v_cohort_size

Internal Helper Functions for Validation of CohortSize 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_stopping

Internal Helper Functions for Validation of Stopping Objects
windowLength

Determine the Safety Window Length of the Next Cohort
update,Data-method

Updating Data Objects
CohortSizeDLT-class

CohortSizeDLT
CohortSizeParts-class

CohortSizeParts
CohortSizeMin-class

CohortSizeMin
.DefaultCohortSize

CohortSize
CrmPackClass-class

CrmPackClass
DADesign-class

DADesign
CohortSizeRange-class

CohortSizeRange
CohortSizeConst-class

CohortSizeConst
CohortSizeOrdinal-class

CohortSizeOrdinal
CohortSizeMax-class

CohortSizeMax