Learn R Programming

crmPack (version 2.1.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 Sabanés Bové et al. (2019) .

Copy Link

Version

Install

install.packages('crmPack')

Monthly Downloads

602

Version

2.1.0

License

GPL (>= 2)

Issues

Pull Requests

Stars

Forks

Maintainer

Daniel Sabanes Bove

Last Published

January 30th, 2026

Functions in crmPack (2.1.0)

DataOrdinal-class

DataOrdinal
Design-class

Design
DualResponsesDesign-class

DualResponsesDesign.R
DesignGrouped-class

DesignGrouped
DualResponsesSamplesDesign-class

DualResponsesSamplesDesign
EffFlexi-class

EffFlexi
Effloglog-class

Effloglog
DataParts-class

DataParts
DesignOrdinal-class

DesignOrdinal
IncrementsOrdinal-class

IncrementsOrdinal
DualSimulationsSummary-class

DualSimulationsSummary
DualSimulations-class

DualSimulations
DualDesign-class

DualDesign
IncrementsDoseLevels-class

IncrementsDoseLevels
IncrementsHSRBeta-class

IncrementsHSRBeta
IncrementsRelative-class

IncrementsRelative
GeneralSimulationsSummary-class

GeneralSimulationsSummary
DualEndpointEmax-class

DualEndpointEmax
DualEndpointRW-class

DualEndpointRW
DataMixture-class

DataMixture
FractionalCRM-class

FractionalCRM
GeneralData-class

GeneralData
IncrementsMin-class

IncrementsMin
LogisticLogNormalMixture-class

LogisticLogNormalMixture
IncrementsMaxToxProb-class

IncrementsMaxToxProb
Increments-class

Increments
LogisticLogNormalOrdinal-class

LogisticLogNormalOrdinal
DualEndpoint-class

DualEndpoint
LogisticNormal-class

LogisticNormal
GeneralModel-class

GeneralModel
GeneralSimulations-class

GeneralSimulations
DualEndpointBeta-class

DualEndpointBeta
IncrementsRelativeDLTCurrent-class

IncrementsRelativeDLTCurrent
LogisticLogNormalSub-class

LogisticLogNormalSub
LogisticLogNormalGrouped-class

LogisticLogNormalGrouped
LogisticLogNormal-class

LogisticLogNormal
IncrementsRelativeDLT-class

IncrementsRelativeDLT
ModelParamsNormal-class

ModelParamsNormal
LogisticKadane-class

LogisticKadane
MinimalInformative

Construct a Minimally Informative Prior
McmcOptions-class

McmcOptions
IncrementsRelativeParts-class

IncrementsRelativeParts
LogisticIndepBeta-class

LogisticIndepBeta
NextBest-class

NextBest
NextBestMTD-class

NextBestMTD
ModelTox-class

ModelTox
NextBestInfTheory-class

NextBestInfTheory
ModelPseudo-class

ModelPseudo
NextBestEWOC-class

NextBestEWOC
LogisticNormalMixture-class

LogisticNormalMixture
LogisticNormalFixedMixture-class

LogisticNormalFixedMixture
NextBestDualEndpoint-class

NextBestDualEndpoint
OneParLogNormalPrior-class

OneParLogNormalPrior
NextBestMinDist-class

NextBestMinDist
NextBestNCRM-class

NextBestNCRM
NextBestNCRMLoss-class

NextBestNCRMLoss
NextBestTD-class

NextBestTD
LogisticKadaneBetaGamma-class

LogisticKadaneBetaGamma
NextBestMaxGainSamples-class

NextBestMaxGainSamples
ModelLogNormal-class

ModelLogNormal
ModelEff-class

ModelEff
OneParExpPrior-class

OneParExpPrior
NextBestMaxGain-class

NextBestMaxGain
NextBestThreePlusThree-class

NextBestThreePlusThree
NextBestTDsamples-class

NextBestTDsamples
OpeningList-class

OpeningList
Opening-class

Opening
OpeningAny-class

OpeningAny
OpeningAll-class

OpeningAll
NextBestOrdinal-class

NextBestOrdinal
NextBestProbMTDLTE-class

NextBestProbMTDLTE
OpeningNone-class

OpeningNone
ProbitLogNormal-class

ProbitLogNormal
NextBestProbMTDMinDist-class

NextBestProbMTDMinDist
PseudoSimulations-class

PseudoSimulations
ProbitLogNormalRel-class

ProbitLogNormalRel
SafetyWindow-class

SafetyWindow
OpeningMinCohorts-class

OpeningMinCohorts
StoppingCohortsNearDose-class

StoppingCohortsNearDose
OpeningMinDose-class

OpeningMinDose
OpeningMinResponses-class

OpeningMinResponses
RecruitmentUnlimited-class

RecruitmentUnlimited
RecruitmentRatio-class

RecruitmentRatio
PseudoDualFlexiSimulations-class

PseudoDualFlexiSimulations
StoppingExternal-class

StoppingExternal
StoppingAny-class

StoppingAny
StoppingHighestDose-class

StoppingHighestDose
PseudoDualSimulationsSummary-class

PseudoDualSimulationsSummary
Recruitment-class

Recruitment
PseudoDualSimulations-class

PseudoDualSimulations
Quantiles2LogisticNormal

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

StoppingAll
RuleDesign-class

RuleDesign
SimulationsSummary-class

SimulationsSummary
StoppingMTDdistribution-class

StoppingMTDdistribution
RuleDesignOrdinal-class

RuleDesignOrdinal
Simulations-class

Simulations
StoppingList-class

StoppingList
StoppingMissingDose-class

StoppingMissingDose
StoppingTDCIRatio-class

StoppingTDCIRatio
StoppingOrdinal-class

StoppingOrdinal
PseudoSimulationsSummary-class

PseudoSimulationsSummary
StoppingLowestDoseHSRBeta-class

StoppingLowestDoseHSRBeta
StoppingTargetProb-class

StoppingTargetProb
Validate

Validate
StoppingMaxGainCIRatio-class

StoppingMaxGainCIRatio
&,StoppingAll,Stopping-method

Combine a Stopping List and an Atomic Stopping Rule with AND
and,Opening,Opening-method

Logical AND Operator for Opening Objects
approximate

Approximate posterior with (log) normal distribution
check_probabilities

Check if an argument is a probability vector
StoppingSpecificDose-class

StoppingSpecificDose
StoppingPatientsNearDose-class

StoppingPatientsNearDose
Samples-class

Samples
SafetyWindowSize-class

SafetyWindowSize
check_length

Check if vectors are of compatible lengths
TDDesign-class

TDDesign
dose

Computing the Doses for a given independent variable, Model and Samples
TITELogisticLogNormal-class

TITELogisticLogNormal
StoppingMinPatients-class

StoppingMinPatients
StartingDose-class

StartingDose
Stopping-class

Stopping
StoppingMinCohorts-class

StoppingMinCohorts
SafetyWindowConst-class

SafetyWindowConst
TDsamplesDesign-class

TDsamplesDesign
doseFunction

Getting the Dose Function for a Given Model Type
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,
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
examine

Obtain Hypothetical Trial Course Table for a Design
fit

Fit method for the Samples class
h_all_equivalent

Comparison with Numerical Tolerance and Without Name Comparison
h_barplot_percentages

Convenience function to make barplots of percentages
crmPackHelp

Open the Browser with Help Pages for crmPack
crmPackExample

Open the Example PDF for crmPack
get_result_list

Helper Function to Obtain Simulation Results List
check_range

Check that an argument is a numerical range
assertions

Additional Assertions for checkmate
h_get_quantiles_start_values

Get Starting Values for Quantiles Optimization
h_group_data

Group Together Mono and Combo Data
StoppingMTDCV-class

StoppingMTDCV
&,Stopping,Stopping-method

Combine Two Stopping Rules with AND
h_check_fun_formals

Checking Formals of a Function
&,Stopping,StoppingAll-method

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

StoppingTargetBiomarker
dapply

Apply a Function to Subsets of Data Frame.
check_probability

Check if an argument is a single probability value
check_format

Check that an argument is a valid format specification
check_probability_range

Check if an argument is a probability range
check_equal

Check if All Arguments Are Equal
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_blind_plot_data

Helper Function to Blind Plot Data
h_format_number

Conditional Formatting Using C-style Formats
h_jags_write_model

Writing JAGS Model to a File
h_kable_param_default

Set Default Values for kable Parameters
biomarker

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

Compute the Density of Inverse Gamma Distribution
h_convert_ordinal_data

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

Testing Matrix for Positive Definiteness
h_next_best_ncrm_loss_plot

Building the Plot for nextBest-NextBestNCRMLoss Method.
h_next_best_td_plot

Building the Plot for nextBest-NextBestTD Method.
h_prepare_units

Append Units to a Numeric Dose
h_next_best_mgsamples_plot

Building the Plot for nextBest-NextBestMaxGainSamples Method.
h_null_if_na

Getting NULL for NA
h_next_best_mg_plot

Building the Plot for nextBest-NextBestMaxGain Method.
h_pseudo_sim_fit_summary

Helper Function to Calculate Fit Summary
dose_grid_range

Getting the Dose Grid Range
gain

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

Building the Plot for nextBest-NextBestTDsamples Method.
h_rapply

Recursively Apply a Function to a List
h_simulations_output_format

Helper Function to create return list for Simulations output
getEff

Extracting Efficacy Responses for Subjects Categorized by the DLT
h_in_range

Check which elements are in a given range
h_next_best_mg_ci

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

Calculating the Information Theoretic Distance
h_enroll_backfill_patients

Helper Function to Enroll Backfill Patients
h_determine_dlts

Helper function to determine the dlts including first separate and placebo condition
get,Samples,character-method

Get specific parameter samples and produce a data.frame
h_obtain_dose_grid_range

Helper Function Containing Common Functionality
h_plot_data_cohort_lines

Preparing Cohort Lines for Data Plot
h_next_best_mg_doses_at_grid

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

Helper Function to Update Backfill Queue
h_unpack_stopit

Helper function to recursively unpack stopping rules and return lists with logical value and label given
knit_print.Backfill

Render a CohortSizeConst Object
logit

Shorthand for Logit Function
h_pseudo_sim_inverse_dose

Helper Function to Calculate Inverse Dose
h_covr_helpers

Helpers for stripping expressions of covr-inserted trace code
h_default_if_empty

Getting the default value for an empty object
enable_logging

Verbose Logging
efficacyFunction

Getting the Efficacy Function for a Given Model Type
mcmc

Obtaining Posterior Samples for all Model Parameters
maxDose

Determine the Maximum Possible Next Dose
match_within_tolerance

Helper Function for Value Matching with Tolerance
h_plot_data_df

Preparing Data for Plotting
crmPack

Object-oriented implementation of CRM designs
h_quantiles_target_function

Target Function for Quantiles Optimization
h_jags_get_model_inits

Setting Initial Values for JAGS Model Parameters
h_get_min_inf_beta

Helper for Minimal Informative Unimodal Beta Distribution
h_get_formatted_dosegrid

Format a doseGrid for Printing
h_convert_ordinal_samples

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

Convert an ordinal CRM model to the Equivalent Binary CRM Model for a Specific Grade
or,Opening,Opening-method

Logical OR Operator for Opening Objects
h_jags_join_models

Joining JAGS Models
nextBest

Finding the Next Best Dose
h_knit_format_func

Used to obtain expected format.
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_find_interval

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

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

Calculate Maximum Number of Backfill Patients
myBayesLogit

MCMC Sampling for Bayesian Logistic Regression Model
names,Samples-method

The Names of the Sampled Parameters
minSize

"MIN" Combination of Cohort Size Rules
plot,DualSimulationsSummary,missing-method

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

Plot GeneralSimulations
plot,DualSimulations,missing-method

Plot DualSimulations
h_jags_get_data

Getting Data for JAGS
h_test_named_numeric

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

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

Extracting Samples from JAGS mcarray Object
h_model_dual_endpoint_sigma2betaw

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

Appending a Dummy Number for Selected Slots in Data
h_plot_data_dataordinal

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

Plot GeneralSimulationsSummary
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
h_model_dual_endpoint_sigma2w

Update DualEndpoint class model components with regard to biomarker regression variance.
or-Stopping-Stopping

Combine Two Stopping Rules with OR
h_validate_combine_results

Combining S4 Class Validation Results
h_next_best_eligible_doses

Get Eligible Doses from the Dose Grid.
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
h_plot_doses_tried

Helper Function to Create Doses Tried Plot
plot,Samples,GeneralModel-method

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

Plot PseudoDualSimulations
h_plot_simulation_trajectory

Helper Function to Create Trajectory Plot
prob

Computing Toxicity Probabilities for a Given Dose, Model and Samples
show,DualSimulationsSummary-method

Show the Summary of Dual-Endpoint Simulations
plot,Samples,DALogisticLogNormal-method

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

Plotting dose-toxicity and dose-biomarker model fits
show,GeneralSimulations-method

Show Simulations Objects
printVignette

Print Vignette
h_validate_common_data_slots

Helper Function performing validation Common to Data and DataOrdinal
or-Stopping-StoppingAny

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

Number of Doses in Grid
simulate,RuleDesign-method

Simulate outcomes from a rule-based design
%>%

Pipe operator
openCohort

Open / recruit backfill patients into a cohort?
plot,Data,ModelTox-method

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

Check That Labels Are Valid and Useful
simulate,TDDesign-method

Simulate dose escalation procedure using DLE responses only without samples
plot,PseudoDualSimulationsSummary,missing-method

Plot PseudoDualSimulationsSummary
plot,DataDual,missing-method

Plot Method for the DataDual Class
show,SimulationsSummary-method

Show the Summary of Model-Based Design Simulations
plot,DataDual,ModelEff-method

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

Plot the fitted dose-efficacy curve using a model from ModelEff class with samples
probFunction

Getting the Prob Function for a Given Model Type
plot,PseudoSimulationsSummary,missing-method

Plot PseudoSimulationsSummary
probit

Shorthand for Probit Function
show,PseudoSimulationsSummary-method

Show the Summary of PseudoSimulations
show,GeneralSimulationsSummary-method

Show the Summary of the Simulations
simulate,DualResponsesDesign-method

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

Simulate Method for the DesignGrouped Class
pinvGamma

Compute the Distribution Function of Inverse Gamma Distribution
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
or-StoppingAny-Stopping

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

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

Plot PseudoDualFlexiSimulations
simulate,DADesign-method

Simulate outcomes from a time-to-DLT augmented CRM design
plot.gtable

Plot gtable Objects
plot,DataDA,missing-method

Plot Method for the DataDA Class
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
h_this_truth

Helper Function to call truth calculation
summary,PseudoDualFlexiSimulations-method

Summarize PseudoDualFlexiSimulations
saveSample

Determining if this Sample Should be Saved
subset-Data

Subsetting Operator for the Data Class
update,DataOrdinal-method

Updating DataOrdinal Objects
update,DataParts-method

Updating DataParts Objects
stopTrial

Stop the trial?
update,DataDual-method

Updating DataDual Objects
summary,PseudoDualSimulations-method

Summarize PseudoDualSimulations
update,DataDA-method

Updating DataDA Objects
simulate,Design-method

Simulate outcomes from a CRM design
set_seed

Helper Function to Set and Save the RNG Seed
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.
summary,DualSimulations-method

Summarize Dual-Endpoint Design Simulations
summary,Simulations-method

Summarize Model-Based Design Simulations
simulate,TDsamplesDesign-method

Simulate dose escalation procedure using DLE responses only with DLE samples
rinvGamma

Random Generation for the Inverse Gamma Distribution
size

Size of an Object
summary,PseudoSimulations-method

Summarize PseudoSimulations
qinvGamma

Compute the Quantile Function of Inverse Gamma Distribution
v_model_objects

Internal Helper Functions for Validation of GeneralModel and ModelPseudo Objects
show,PseudoDualSimulationsSummary-method

Show the Summary of PseudoDualSimulations
v_safety_window

Internal Helper Functions for Validation of SafetyWindow Objects
summary,GeneralSimulations-method

Summarize the GeneralSimulations, Relative to a Given Truth
windowLength

Determine the Safety Window Length of the Next Cohort
v_cohort_size

Internal Helper Functions for Validation of CohortSize Objects
v_design

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

Updating Data Objects
simulate,DualResponsesSamplesDesign-method

Simulate dose escalation procedure using DLE and efficacy responses with samples
tidy

Tidying CrmPackClass objects
v_backfill

Internal Helper Functions for Validation of Backfill Objects
v_pseudo_simulations

Internal Helper Functions for Validation of PseudoSimulations Objects
v_recruitment

Internal Helper Functions for Validation of Recruitment Objects
v_data_objects

Internal Helper Functions for Validation of GeneralData Objects
v_model_params

Internal Helper Functions for Validation of Model Parameters Objects
v_samples_objects

Internal Helper Functions for Validation of Samples Objects
v_increments

Internal Helper Functions for Validation of Increments Objects
v_general_simulations

Internal Helper Functions for Validation of GeneralSimulations Objects
v_mcmcoptions_objects

Internal Helper Functions for Validation of McmcOptions Objects
v_opening

Internal Helper Functions for Validation of Opening Objects
v_next_best

Internal Helper Functions for Validation of NextBest Objects
v_stopping

Internal Helper Functions for Validation of Stopping Objects
v_starting_dose

Internal Helper Functions for Validation of StartingDose Objects
positive_number

positive_number
simulate,DualDesign-method

Simulate outcomes from a dual-endpoint design
CohortSizeOrdinal-class

CohortSizeOrdinal
CohortSizeParts-class

CohortSizeParts
CohortSizeMax-class

CohortSizeMax
CohortSizeConst-class

CohortSizeConst
CohortSizeMin-class

CohortSizeMin
CohortSizeDLT-class

CohortSizeDLT
CohortSizeRandom-class

CohortSizeRandom
.DefaultCohortSize

CohortSize
CohortSizeRange-class

CohortSizeRange
Backfill-class

Backfill class
DLTLikelihood

Likelihood of DLTs in each interval
DASimulations-class

DASimulations
DALogisticLogNormal-class

DALogisticLogNormal
DADesign-class

DADesign
DataDual-class

DataDual
DataDA-class

DataDA
Data-class

Data
DataGrouped-class

DataGrouped
CrmPackClass-class

CrmPackClass