Package 'iAdapt'

Title: Two-Stage Adaptive Dose-Finding Clinical Trial Design
Description: Simulate and implement early phase two-stage adaptive dose-finding design for binary and quasi-continuous toxicity endpoints. See Chiuzan et al. (2018) for further reading <DOI:10.1080/19466315.2018.1462727>.
Authors: Alyssa Vanderbeek [aut, cre], Laura Cosgrove [ctb], Elizabeth Garrett-Mayer [ctb], Cody Chiuzan [ctb]
Maintainer: Alyssa Vanderbeek <[email protected]>
License: LGPL-3
Version: 2.0.1
Built: 2024-12-23 06:36:31 UTC
Source: CRAN

Help Index


Calculate DLT probability corresponding to average nTTP for each dose

Description

Calculate DLT probability corresponding to average nTTP for each dose

Usage

dlt.prob(dose, ntox, TOX, grade.thresh)

Arguments

dose

number of doses to be tested (scalar)

ntox

number (integer) of different toxicity types (e.g, hematological, neurological, GI)

TOX

matrix array of toxicity probabilities. There should be ntox matrices. Each matrix represents one toxicity type, where probabilities of each toxicity grade are specified across each dose. Each matrix has the same dimensions: n rows, representing number of doses, and 5 columns (for grades 0-4, since the probability of a grade 0 event may not be 0). Probabilities across each dose (rows) must sum to 1. See Ezzalfani et al. (2013) for details.

grade.thresh

grade (0-4) at which each toxicity type qualifies as a DLT

Value

ptox - Vector of DLT probabilities per dose.

Examples

# Number of test doses
dose = 6

# Number of toxicity types
ntox <- 3
           
# Array of toxicity event probabilities
TOX = array(NA, c(dose, 5, ntox)) 

TOX[, , 1] = matrix(c(0.823, 0.152, 0.022, 0.002, 0.001,  #prob of tox for dose 1 and tox type 1
                      0.791, 0.172, 0.032, 0.004, 0.001,  #prob of tox for dose 2 and tox type 1
                      0.758, 0.180, 0.043, 0.010, 0.009,  #prob of tox for dose 3 and tox type 1
                      0.685, 0.190, 0.068, 0.044, 0.013,  #prob of tox for dose 4 and tox type 1
                      0.662, 0.200, 0.078, 0.046, 0.014,  #prob of tox for dose 5 and tox type 1
                      0.605, 0.223, 0.082, 0.070, 0.020), #prob of tox for dose 6 and tox type 1
                      nrow = 6, byrow = TRUE)
TOX[, , 2] = matrix(c(0.970, 0.027, 0.002, 0.001, 0.000,  #prob of tox for dose 1 and tox type 2
                      0.968, 0.029, 0.002, 0.001, 0.000,  #prob of tox for dose 2 and tox type 2
                      0.813, 0.172, 0.006, 0.009, 0.000,  #prob of tox for dose 3 and tox type 2
                      0.762, 0.183, 0.041, 0.010, 0.004,  #prob of tox for dose 4 and tox type 2
                      0.671, 0.205, 0.108, 0.011, 0.005,  #prob of tox for dose 5 and tox type 2
                      0.397, 0.258, 0.277, 0.060, 0.008), #prob of tox for dose 6 and tox type 2
                      nrow = 6, byrow = TRUE)
TOX[, , 3] = matrix(c(0.930, 0.060, 0.005, 0.001, 0.004,  #prob of tox for dose 1 and tox type 3
                      0.917, 0.070, 0.007, 0.001, 0.005,  #prob of tox for dose 2 and tox type 3
                      0.652, 0.280, 0.010, 0.021, 0.037,  #prob of tox for dose 3 and tox type 3
                      0.536, 0.209, 0.031, 0.090, 0.134,  #prob of tox for dose 4 and tox type 3
                      0.015, 0.134, 0.240, 0.335, 0.276,  #prob of tox for dose 5 and tox type 3
                      0.005, 0.052, 0.224, 0.372, 0.347), #prob of tox for dose 6 and tox type 3
                      nrow = 6, byrow = TRUE)
                      
# Grades at which each tox type qualifies as DLT
grade.thresh = c(3, 3, 4)

dlt.prob(dose = dose, ntox = ntox, TOX = TOX, grade.thresh = grade.thresh)

Generates efficacy outcomes for stage 1 when using binary toxicity

Description

Function eff.stg1() uses a beta-binomial distribution to generate outcomes (Ys) corresponding to acceptable dose assignments from stage 1.

Usage

eff.stg1(dose, dose.tox, p1, p2, K, coh.size, m, v, nbb = 100)

Arguments

dose

number of doses to be tested (scalar)

dose.tox

vector of true toxicities for each dose. Values range from 0 - 1.

p1

toxicity under null (unsafe DLT rate). Values range from 0 - 1.

p2

toxicity under alternative (safe DLT rate). Values range from 0 - 1; p1 > p2

K

threshold for LR. Takes integer values: 1,2,...(recommended K=2)

coh.size

cohort size (number of patients) per dose (Stage 1)

m

vector of mean efficacies per dose. Values range from 0 - 100. (e.g, T cell persistence - values b/w 5 and 80 per cent)

v

vector of efficacy variances per dose. Values range from 0 - 1. (e.g., 0.01)

nbb

binomial parameter (default = 100 cells per patient)

Value

List of efficacy outcomes for subjects enrolled during stage 1 (dose-escalation)

  • Y.safe - vector of efficacy outcomes for each subject assigned to an acceptable safe dose

  • d.safe - vector of dose allocation for each subject assigned to an acceptable safe dose

  • tox.safe - number of dose-limiting toxicities for each safe dose level

  • Y.alloc - vector of efficacy outcomes for all subjects from stage 1 (acceptable and unsafe doses)

  • d.alloc - vector of dose allocation for all subjects from stage 1 (acceptable and unsafe doses)

Examples

# Number of pre-specified dose levels
dose <- 5
# Vector of true toxicities associated with each dose
dose.tox <- c(0.05, 0.10, 0.20, 0.35, 0.45)       
# Acceptable (p2) and unacceptable (p1) DLT rates used for establishing safety
p1 <- 0.40                                     
p2 <- 0.15   

# Likelihood-ratio (LR) threshold
K <- 2                                          

# Cohort size used in stage 1
coh.size <- 3 

# Vector of true mean efficacies per dose (here mean percent persistence per dose)
m <- c(5, 15, 40, 65, 80)   # MUST BE THE SAME LENGTH AS dose.tox                  

# Efficacy (equal) variance per dose
v <- rep(0.01, 5) 

# Total sample size (stages 1&2)                            
N <- 25                                        

# Stopping rule: if dose 1 is the only safe dose, allocate up to 9 pts.
stop.rule <- 9 

eff.stg1(dose = dose, dose.tox = dose.tox, p1 = p1, p2 = p2, K = K, 
coh.size = coh.size, m, v, nbb = 100)

Generates efficacy outcomes for stage 1 when using nTTP to measure toxicity

Description

Function eff.stg1.nTTP() uses a beta-binomial distribution to generate outcomes (Ys) corresponding to acceptable dose assignments from stage 1.

Usage

eff.stg1.nTTP(
  dose,
  p1,
  p2,
  K,
  coh.size,
  m,
  v,
  nbb = 100,
  W,
  TOX,
  ntox,
  std.nTTP
)

Arguments

dose

number of doses to be tested (scalar)

p1

toxicity under null (unsafe nTTP). Values range from 0 - 1.

p2

toxicity under alternative (safe nTTP). Values range from 0 - 1; p1 > p2

K

threshold for LR. Takes integer values: 1,2,...(recommended K=2)

coh.size

cohort size (number of patients) per dose (Stage 1)

m

vector of mean efficacies per dose. Values range from 0 - 100. (e.g, T cell persistence - values b/w 5 and 80 per cent)

v

vector of efficacy variances per dose. Values range from 0 - 1. (e.g., 0.01)

nbb

binomial parameter (default = 100 cells per patient)

W

matrix defining burden weight of each grade level for all toxicity types. The dimensions are ntox rows by 4 columns (for grades 0-4). See Ezzalfani et al. (2013) for details.

TOX

matrix array of toxicity probabilities. There should be ntox matrices. Each matrix represents one toxicity type, where probabilities of each toxicity grade are specified across each dose. Each matrix has the same dimensions: n rows, representing number of doses, and 5 columns (for grades 0-4). Probabilities across each dose (rows) must sum to 1. See Ezzalfani et al. (2013) for details.

ntox

number (integer) of different toxicity types

std.nTTP

the standard deviation of nTTP scores at each dose level (assumed constant across doses)

Value

List of efficacy outcomes for subjects enrolled during stage 1 (dose-escalation)

  • Y.safe - vector of efficacy outcomes for each subject assigned to an acceptable safe dose

  • d.safe - vector of dose allocation for each subject assigned to an acceptable safe dose

  • tox.safe - number of dose-limiting toxicities for each safe dose level

  • Y.alloc - vector of efficacy outcomes for all subjects from stage 1 (acceptable and unsafe doses)

  • d.alloc - vector of dose allocation for all subjects from stage 1 (acceptable and unsafe doses)

  • all_nttp - all observed nTTP values

Examples

# Number of pre-specified dose levels
dose <- 6      

# Acceptable (p2) and unacceptable nTTP values
p1 <- 0.35                                     
p2 <- 0.10    

# Likelihood-ratio (LR) threshold
K <- 2                                          

# Cohort size used in stage 1
coh.size <- 3 

# Efficacy (equal) variance per dose
v <- rep(0.01, 6)

# Dose-efficacy curve
m = c(10, 20, 30, 40, 70, 90)

# Number of toxicity types
ntox <- 3

# Toxicity burden weight matrix
W = matrix(c(0, 0.5, 0.75, 1.0, 1.5, # Burden weight for grades 0-4 for toxicity 1
             0, 0.5, 0.75, 1.0, 1.5, # Burden weight for grades 0-4 for toxicity 2
             0, 0.00, 0.00, 0.5, 1), # Burden weight for grades 0-4 for toxicity 3
           nrow = ntox, byrow = TRUE)
           

# standard deviation of nTTP values
std.nTTP = 0.15

# Array of toxicity event probabilities
TOX <- array(NA, c(dose, 5, ntox)) 

TOX[, , 1] = matrix(c(0.823, 0.152, 0.022, 0.002, 0.001,
                      0.791, 0.172, 0.032, 0.004, 0.001,
                      0.758, 0.180, 0.043, 0.010, 0.009,
                      0.685, 0.190, 0.068, 0.044, 0.013,
                      0.662, 0.200, 0.078, 0.046, 0.014,
                      0.605, 0.223, 0.082, 0.070, 0.020),
                    nrow = 6, byrow = TRUE)
TOX[, , 2] = matrix(c(0.970, 0.027, 0.002, 0.001, 0.000,
                      0.968, 0.029, 0.002, 0.001, 0.000,
                      0.813, 0.172, 0.006, 0.009, 0.000,
                      0.762, 0.183, 0.041, 0.010, 0.004,
                      0.671, 0.205, 0.108, 0.011, 0.005,
                      0.397, 0.258, 0.277, 0.060, 0.008),
                    nrow = 6, byrow = TRUE)
TOX[, , 3] = matrix(c(0.930, 0.060, 0.005, 0.001, 0.004,
                      0.917, 0.070, 0.007, 0.001, 0.005,
                      0.652, 0.280, 0.010, 0.021, 0.037,
                      0.536, 0.209, 0.031, 0.090, 0.134,
                      0.015, 0.134, 0.240, 0.335, 0.276,
                      0.005, 0.052, 0.224, 0.372, 0.347),
                    nrow = 6, byrow = TRUE)

eff.stg1.nTTP(dose = dose, p1 = p1, p2 = p2, K = K, coh.size = coh.size, 
m = m, v = v, nbb = 100, W = W, TOX = TOX, ntox = ntox, std.nTTP = std.nTTP)

Obtain average nTTP at each dose level

Description

Obtain average nTTP at each dose level

Usage

get.thresh(dose, ntox, W, TOX)

Arguments

dose

number of doses to be tested (scalar)

ntox

number (integer) of different toxicity types (e.g, hematological, neurological, GI)

W

matrix defines burden weight of each grade level for all toxicity types. The dimensions are ntox rows by 4 columns (for grades 0-4). See Ezzalfani et al. (2013) for details.

TOX

matrix array of toxicity probabilities. There should be ntox matrices. Each matrix represents one toxicity type, where probabilities of each toxicity grade are specified across each dose. Each matrix has the same dimensions: n rows, representing number of doses, and 5 columns (for grades 0-4). Probabilities across each dose (rows) must sum to 1. See Ezzalfani et al. (2013) for details.

Value

Vector of average nTTP for each dose level.

Examples

# Number of test doses
dose = 6

# Number of toxicity types
ntox <- 3
 
# Toxicity burden weight matrix
W = matrix(c(0, 0.5, 0.75, 1.0, 1.5, # Burden weight for grades 0-4 for toxicity 1
             0, 0.5, 0.75, 1.0, 1.5, # Burden weight for grades 0-4 for toxicity 2
             0, 0.00, 0.00, 0.5, 1), # Burden weight for grades 0-4 for toxicity 3
           nrow = ntox, byrow = TRUE)
           

# Array of toxicity event probabilities
TOX = array(NA, c(dose, 5, ntox)) 

TOX[, , 1] = matrix(c(0.823, 0.152, 0.022, 0.002, 0.001,  #prob of tox for dose 1 and tox type 1
                      0.791, 0.172, 0.032, 0.004, 0.001,  #prob of tox for dose 2 and tox type 1
                      0.758, 0.180, 0.043, 0.010, 0.009,  #prob of tox for dose 3 and tox type 1
                      0.685, 0.190, 0.068, 0.044, 0.013,  #prob of tox for dose 4 and tox type 1
                      0.662, 0.200, 0.078, 0.046, 0.014,  #prob of tox for dose 5 and tox type 1
                      0.605, 0.223, 0.082, 0.070, 0.020), #prob of tox for dose 6 and tox type 1
                      nrow = 6, byrow = TRUE)
TOX[, , 2] = matrix(c(0.970, 0.027, 0.002, 0.001, 0.000,  #prob of tox for dose 1 and tox type 2
                      0.968, 0.029, 0.002, 0.001, 0.000,  #prob of tox for dose 2 and tox type 2
                      0.813, 0.172, 0.006, 0.009, 0.000,  #prob of tox for dose 3 and tox type 2
                      0.762, 0.183, 0.041, 0.010, 0.004,  #prob of tox for dose 4 and tox type 2
                      0.671, 0.205, 0.108, 0.011, 0.005,  #prob of tox for dose 5 and tox type 2
                      0.397, 0.258, 0.277, 0.060, 0.008), #prob of tox for dose 6 and tox type 2
                      nrow = 6, byrow = TRUE)
TOX[, , 3] = matrix(c(0.930, 0.060, 0.005, 0.001, 0.004,  #prob of tox for dose 1 and tox type 3
                      0.917, 0.070, 0.007, 0.001, 0.005,  #prob of tox for dose 2 and tox type 3
                      0.652, 0.280, 0.010, 0.021, 0.037,  #prob of tox for dose 3 and tox type 3
                      0.536, 0.209, 0.031, 0.090, 0.134,  #prob of tox for dose 4 and tox type 3
                      0.015, 0.134, 0.240, 0.335, 0.276,  #prob of tox for dose 5 and tox type 3
                      0.005, 0.052, 0.224, 0.372, 0.347), #prob of tox for dose 6 and tox type 3
                      nrow = 6, byrow = TRUE)
                      
get.thresh(dose = dose, ntox = ntox, W = W, TOX = TOX)

Calculates likelihood of safety for single dose

Description

Function LRtox() calculates the likelihood of safety for a single dose and designates whether to escalate to the next dose (safe) or stop dose escalation and move onto stage 2 (unsafe).

Usage

LRtox(coh.size, ndlt, p1, p2, K = 2)

Arguments

coh.size

cohort size (number of patients) per dose (Stage 1)

ndlt

number of observed DLTs

p1

toxicity under null (unsafe DLT rate). Values range from 0 - 1.

p2

toxicity under alternative (safe DLT rate). Values range from 0 - 1; p1 > p2

K

threshold for LR. Takes integer values: 1,2,...(recommended K=2)

Value

List object that gives the likelihood ratio of safety and indicates whether to escalate to the next highest dose level, or stop dose escalation and move onto stage 2.

Examples

LRtox(coh.size = 3, ndlt = 2, p1 = 0.40, p2 = 0.15, K = 2)
LRtox(coh.size = 3, ndlt = 1, p1 = 0.40, p2 = 0.15, K = 2)

Calculates likelihood of safety for single dose, using nTTP

Description

(nTTP) Function LRtox.nTTP() calculates the likelihood of safety for a single dose and designates whether to escalate to the next dose (safe) or stop dose escalation and move onto stage 2 (unsafe).

Usage

LRtox.nTTP(tox_grades, ntox, coh.size, W, p1, p2, K = 2, std.nTTP = 0.15)

Arguments

tox_grades

data frame of observed AE grades for each patient (rows) across all toxicity types (columns). e.g. for one patient, grades for 3 toxicity types might be c(3, 2, 4), where they experienced a grade 3 AE for tox type 1, grade 2 AE for tox type 2, etc.

ntox

number (integer) of different toxicity types

coh.size

cohort size (number of patients) per dose (Stage 1)

W

matrix defining burden weight of each grade level for all toxicity types. The dimensions are ntox rows by 5 columns (for grades 0-4). See Ezzalfani et al. (2013) for details.

p1

toxicity under null (unsafe DLT rate). Values range from 0 - 1.

p2

toxicity under alternative (safe DLT rate). Values range from 0 - 1; p1 > p2

K

threshold for LR. Takes integer values: 1,2,...(recommended K=2)

std.nTTP

the standard deviation of nTTP scores at each dose level (constant across doses)

Value

List object that gives the likelihood ratio of safety and indicates whether to escalate to the next highest dose level, or stop dose escalation and move onto stage 2.

Examples

ntox = 3 # three different types of toxicity 
coh.size = 3 # number of patients enrolled per dose

# Observed AE grades for each patient on tested dose
obs = data.frame(tox1 = c(3, 2, 4),
                 tox2 = c(1, 1, 2),
                 tox3 = c(2, 3, 3))
                
# Toxicity burden weight matrix
W = matrix(c(0, 0.5, 0.75, 1.0, 1.5, # Burden weight for grades 0-4 for toxicity 1
             0, 0.5, 0.75, 1.0, 1.5, # Burden weight for grades 0-4 for toxicity 2
             0, 0.00, 0.00, 0.5, 1), # Burden weight for grades 0-4 for toxicity 3
             nrow = ntox, byrow = TRUE) 
             
# Acceptable (p2) and unacceptable nTTP values
p1 <- 0.35                                     
p2 <- 0.10       
             
LRtox.nTTP(obs, ntox, coh.size, W, p1, p2, K = 2, std.nTTP = 0.15)

Simulate full trial (both stages) x times when using nTTP to measure toxicity

Description

Results are displayed in a matrix format, where each row represents one trial simulation

Usage

nTTP.indiv.sim(W, TOX, ntox, dose)

Arguments

W

matrix defining burden weight of each grade level for all toxicity types. The dimensions are ntox rows by 5 columns (for grades 0-4). See Ezzalfani et al. (2013) for details.

TOX

matrix array of toxicity probabilities. There should be ntox matrices. Each matrix represents one toxicity type, where probabilities of each toxicity grade are specified across each dose. Each matrix has the same dimensions: n rows, representing number of doses, and 5 columns (for grades 0-4). Probabilities across each dose (rows) must sum to 1. See Ezzalfani et al. (2013) for details.

ntox

number (integer) of different toxicity types

dose

number of doses to be tested (scalar)

Value

List of the following objects:

  • sim.Y - estimated efficacy per each dose assignment

  • sim.d - dose assignment for each patient in the trial


Calculates randomization probabilities and dose allocation for next patient

Description

Function rand.prob() calculates the updated randomization probabilities based on observed efficacies up to that point. It also gives the dose allocation for the next enrolled patient based on these probabilities.

Usage

rand.prob(y.eff, d.safe)

Arguments

y.eff

vector of all efficacy outcomes for each dose allocation

d.safe

vector of dose assignment

Value

List object giving

  • Rand.Prob - randomization probability for each safe dose (from stage 1)

  • Next.Dose - the dose to enroll the next patient on

Examples

y.eff <- c(9, 1, 0, 34, 10, 27, 38, 42, 60, 75, 48, 62)
d.safe <- c(1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4)
rand.prob(y.eff, d.safe)

Stage 2 Adaptive Randomization

Description

Function rand.stg2() fits a linear regression for the continuous efficacy outcomes, computes the randomization probabilities/dose and allocates the next patient to a dose that is considered acceptably safe and has the most promising efficacy. Dose safety is still monitored using LR and doses that become unacceptable are discarded (never re-visited).

Usage

rand.stg2(
  dose,
  dose.tox,
  p1,
  p2,
  K,
  coh.size,
  m,
  v,
  N,
  stop.rule = 9,
  cohort = 1,
  samedose = TRUE,
  nbb = 100
)

Arguments

dose

number of doses to be tested (scalar)

dose.tox

vector of true toxicities for each dose. Values range from 0 - 1.

p1

toxicity under null (unsafe DLT rate). Values range from 0 - 1.

p2

toxicity under alternative (safe DLT rate). Values range from 0 - 1; p1 > p2

K

threshold for LR. Takes integer values: 1,2,...(recommended K=2)

coh.size

cohort size (number of patients) per dose (Stage 1)

m

vector of mean efficacies per dose. Values range from 0 - 100. (e.g, T cell persistence - values b/w 5 and 80 per cent)

v

vector of efficacy variances per dose. Values range from 0 - 1. (e.g., 0.01)

N

total sample size for stages 1&2

stop.rule

if only dose 1 safe, allocate up to 9 (default) patients at dose 1 to collect more info

cohort

cohort size (number of patients) per dose (Stage 2). Default is 1.

samedose

designates whether the next patient is allocated to the same dose as the previous patient. Default is TRUE. Function adjusts accordingly.

nbb

binomial parameter (default = 100 cells per patient)

Value

List of the following objects:

  • Y.final - vector of all efficacy outcomes (Ys) corresponding to dose assignments (Stages 1&2)

  • d.final - vector of all dose assignments(Stages 1&2)

If dose allocation stops early, put NAs in d.final and y.final until it reaches the total sample size.

Examples

# Number of pre-specified dose levels
dose <- 5
# Vector of true toxicities associated with each dose
dose.tox <- c(0.05, 0.10, 0.20, 0.35, 0.45)       
# Acceptable (p_yes) and unacceptable (p_no) DLT rates used for establishing safety
p_no <- 0.40                                     
p_yes <- 0.15    

# Likelihood-ratio (LR) threshold
K <- 2                                          

# Cohort size used in stage 1
coh.size <- 3 

# Vector of true mean efficacies per dose (here mean percent persistence per dose)
m <- c(5, 15, 40, 65, 80)   # MUST BE THE SAME LENGTH AS dose.tox                  

# Efficacy(equal) variance per dose
v <- rep(0.01, 5) 

# Total sample size (stages 1&2)                            
N <- 25                                        

# Stopping rule: if dose 1 is the only safe dose, allocate up to 9 pts.
stop.rule <- 9 

rand.stg2(dose, dose.tox, p_no, p_yes, K, coh.size, m, v, N, stop.rule = stop.rule, 
cohort = 1, samedose = TRUE, nbb = 100)

Stage 2 Adaptive Randomization with nTTP to monitor toxicity

Description

Function rand.stg2.nTTP() fits a linear regression for the continuous efficacy outcomes, computes the randomization probabilities/dose and allocates the next patient to a dose that is considered acceptably safe and has the highest efficacy. Dose safety (with nTTP) is still monitored using LR and doses that become unacceptable are discarded (never re-visited).

Usage

rand.stg2.nTTP(
  dose,
  p1,
  p2,
  K,
  coh.size,
  m,
  v,
  N,
  stop.rule = 9,
  cohort = 1,
  samedose = TRUE,
  nbb = 100,
  W,
  TOX,
  ntox,
  std.nTTP = 0.15
)

Arguments

dose

number of doses to be tested (scalar)

p1

toxicity under null (unsafe nTTP). Values range from 0 - 1.

p2

toxicity under alternative (safe nTTP). Values range from 0 - 1; p1 > p2

K

threshold for LR. Takes integer values: 1,2,...(recommended K=2)

coh.size

cohort size (number of patients) per dose (Stage 1)

m

vector of mean efficacies per dose. Values range from 0 - 100. (e.g, T cell persistence - values b/w 5 and 80 per cent)

v

vector of efficacy variances per dose. Values range from 0 - 1. (e.g., 0.01)

N

total sample size for stages 1&2

stop.rule

if only dose 1 safe, allocate up to 9 (default) patients at dose 1 to collect more info

cohort

cohort size (number of patients) per dose (Stage 2). Default is 1.

samedose

designates whether the next patient is allocated to the same dose as the previous patient. Default is TRUE. Function adjusts accordingly.

nbb

binomial parameter (default = 100 cells per patient)

W

matrix defining burden weight of each grade level for all toxicity types. The dimensions are ntox rows by 4 columns (for grades 0-4). See Ezzalfani et al. (2013) for details.

TOX

matrix array of toxicity probabilities. There should be ntox matrices. Each matrix represents one toxicity type, where probabilities of each toxicity grade are specified across each dose. Each matrix has the same dimensions: n rows, representing number of doses, and 5 columns (for grades 0-4). Probabilities across each dose (rows) must sum to 1. See Ezzalfani et al. (2013) for details.

ntox

number (integer) of different toxicity types

std.nTTP

the standard deviation of nTTP scores at each dose level (constant across doses)

Value

List of the following objects:

  • Y.final - vector of all efficacy outcomes (Ys) corresponding to dose assignments (Stages 1&2)

  • d.final - vector of all dose assignments(Stage 1&2)

  • n1 - Stage 1 sample size

If dose allocation stops early, put NAs in d.final and y.final until it reaches the total sample size.

Examples

# Number of pre-specified dose levels
dose <- 6      

# Acceptable (p2) and unacceptable nTTP values
p1 <- 0.35                                     
p2 <- 0.10     

# Likelihood-ratio (LR) threshold
K <- 2                                          

# Cohort size used in stage 1
coh.size <- 3 

# Total sample size (stages 1&2)                            
N <- 25 

# Efficacy (equal) variance per dose
v <- rep(0.01, 6)

# Dose-efficacy curve
m = c(10, 20, 30, 40, 70, 90)

# Number of toxicity types
ntox <- 3

# Toxicity burden weight matrix
W = matrix(c(0, 0.5, 0.75, 1.0, 1.5, # Burden weight for grades 0-4 for toxicity 1
             0, 0.5, 0.75, 1.0, 1.5, # Burden weight for grades 0-4 for toxicity 2
             0, 0.00, 0.00, 0.5, 1), # Burden weight for grades 0-4 for toxicity 3
           nrow = ntox, byrow = TRUE)
           
# Standard deviation of nTTP value
std.nTTP = 0.15

# Array of toxicity event probabilities
TOX <- array(NA, c(dose, 5, ntox)) 

TOX[, , 1] = matrix(c(0.823, 0.152, 0.022, 0.002, 0.001,
                      0.791, 0.172, 0.032, 0.004, 0.001,
                      0.758, 0.180, 0.043, 0.010, 0.009,
                      0.685, 0.190, 0.068, 0.044, 0.013,
                      0.662, 0.200, 0.078, 0.046, 0.014,
                      0.605, 0.223, 0.082, 0.070, 0.020),
                      nrow = 6, byrow = TRUE)
TOX[, , 2] = matrix(c(0.970, 0.027, 0.002, 0.001, 0.000,
                      0.968, 0.029, 0.002, 0.001, 0.000,
                      0.813, 0.172, 0.006, 0.009, 0.000,
                      0.762, 0.183, 0.041, 0.010, 0.004,
                      0.671, 0.205, 0.108, 0.011, 0.005,
                      0.397, 0.258, 0.277, 0.060, 0.008),
                      nrow = 6, byrow = TRUE)
TOX[, , 3] = matrix(c(0.930, 0.060, 0.005, 0.001, 0.004,
                      0.917, 0.070, 0.007, 0.001, 0.005,
                      0.652, 0.280, 0.010, 0.021, 0.037,
                      0.536, 0.209, 0.031, 0.090, 0.134,
                      0.015, 0.134, 0.240, 0.335, 0.276,
                      0.005, 0.052, 0.224, 0.372, 0.347),
                      nrow = 6, byrow = TRUE)

rand.stg2.nTTP(dose = dose, p1 = p1, p2 = p2, K = K, coh.size = coh.size, 
m = m, v = v, N = N, stop.rule = 9, 
cohort = 1, samedose = TRUE, nbb = 100, W = W, TOX = TOX, ntox = ntox, std.nTTP = std.nTTP)

Identify safe/acceptable doses from stage 1 based on observed binary toxicity

Description

Function safe.dose() distinguishes acceptable from unacceptable doses

Usage

safe.dose(dose, dose.tox, p1, p2, K, coh.size)

Arguments

dose

number of doses to be tested (scalar)

dose.tox

vector of true toxicities for each dose. Values range from 0 - 1.

p1

toxicity under null (unsafe DLT rate). Values range from 0 - 1.

p2

toxicity under alternative (safe DLT rate). Values range from 0 - 1; p1 > p2

K

threshold for LR. Takes integer values: 1,2,...(recommended K=2)

coh.size

cohort size (number of patients) per dose (Stage 1)

Value

List of the following objects:

  • alloc.safe - matrix of assignments only for acceptable doses (to be used in stage 2) and their corresponding toxicities

  • alloc.total - vector of all dose assignments from stage 1

  • n1 - total number of subjects allocated in stage 1

Examples

dose = 5                                      # Dose levels
dose.tox <- c(0.05, 0.10, 0.15, 0.20, 0.30)   # True toxicity per dose
p1 = 0.40                                     # Unacceptable DLT rate
p2 = 0.15                                     # Acceptable DLT rate
K = 2                                         # Likelihood-ratio (LR) threshold
coh.size = 3                                  # Assign 3 pts per dose in stage 1

safe.dose(dose = dose, dose.tox = dose.tox, p1 = p1, p2 = p2, K = K, coh.size = coh.size)

Identify safe/acceptable doses from stage 1 based on nTTP scores.

Description

Function safe.dose.nTTP() distinguishes acceptable from unacceptable doses

Usage

safe.dose.nTTP(dose, p1, p2, K, coh.size, W, TOX, ntox, std.nTTP = 0.15)

Arguments

dose

number of doses to be tested (scalar)

p1

toxicity under null (unsafe nTTP). Values range from 0 - 1.

p2

toxicity under alternative (safe nTTP). Values range from 0 - 1; p1 > p2

K

threshold for LR. Takes integer values: 1,2,...(recommended K=2)

coh.size

cohort size (number of patients) per dose (Stage 1)

W

matrix defining burden weight of each grade level for all toxicity types. The dimensions are ntox rows by 4 columns (for grades 0-4). See Ezzalfani et al. (2013) for details.

TOX

matrix array of toxicity probabilities. There should be ntox matrices. Each matrix represents one toxicity type, where probabilities of each toxicity grade are specified across each dose. Each matrix has the same dimensions: n rows, representing number of doses, and 5 columns (for grades 0-4). Probabilities across each dose (rows) must sum to 1. See Ezzalfani et al. (2013) for details.

ntox

number (integer) of different toxicity types

std.nTTP

the standard deviation of nTTP scores at each dose level (constant across doses)

Value

List of the following objects:

  • alloc.safe - matrix of assignments only for acceptable doses (to be used in stage 2) and their corresponding toxicities

  • alloc.total - vector of all dose assignments from stage 1

  • n1 - total number of subjects allocated in stage 1

  • all_nttp - all observed nTTP values

Examples

# Number of pre-specified dose levels
dose <- 6      

# Acceptable (p2) and unacceptable nTTP values
p1 <- 0.35                                     
p2 <- 0.10     

# Likelihood-ratio (LR) threshold
K <- 2                                          

# Cohort size used in stage 1
coh.size <- 3 

# Number of toxicity types
ntox <- 3

# Standard deviation of nTTP values
std.nTTP = 0.15

# Toxicity burden weight matrix
W = matrix(c(0, 0.5, 0.75, 1.0, 1.5, # Burden weight for grades 0-4 for toxicity 1
             0, 0.5, 0.75, 1.0, 1.5, # Burden weight for grades 0-4 for toxicity 2
             0, 0.00, 0.00, 0.5, 1), # Burden weight for grades 0-4 for toxicity 3
           nrow = ntox, byrow = TRUE)
           
# Array of toxicity event probabilities
TOX <- array(NA, c(dose, 5, ntox)) 

TOX[, , 1] = matrix(c(0.823, 0.152, 0.022, 0.002, 0.001,
                      0.791, 0.172, 0.032, 0.004, 0.001,
                      0.758, 0.180, 0.043, 0.010, 0.009,
                      0.685, 0.190, 0.068, 0.044, 0.013,
                      0.662, 0.200, 0.078, 0.046, 0.014,
                      0.605, 0.223, 0.082, 0.070, 0.020),
                      nrow = 6, byrow = TRUE)
TOX[, , 2] = matrix(c(0.970, 0.027, 0.002, 0.001, 0.000,
                      0.968, 0.029, 0.002, 0.001, 0.000,
                      0.813, 0.172, 0.006, 0.009, 0.000,
                      0.762, 0.183, 0.041, 0.010, 0.004,
                      0.671, 0.205, 0.108, 0.011, 0.005,
                      0.397, 0.258, 0.277, 0.060, 0.008),
                      nrow = 6, byrow = TRUE)
TOX[, , 3] = matrix(c(0.930, 0.060, 0.005, 0.001, 0.004,
                      0.917, 0.070, 0.007, 0.001, 0.005,
                      0.652, 0.280, 0.010, 0.021, 0.037,
                      0.536, 0.209, 0.031, 0.090, 0.134,
                      0.015, 0.134, 0.240, 0.335, 0.276,
                      0.005, 0.052, 0.224, 0.372, 0.347),
                      nrow = 6, byrow = TRUE)

safe.dose.nTTP(dose = dose, p1 = p1, p2 = p2, K = K, coh.size = coh.size, 
W = W, TOX = TOX, ntox = ntox, std.nTTP = std.nTTP)

Generate plots for estimated percent allocation and response per dose.

Description

Generate plots for estimated percent allocation and response per dose.

Usage

sim.plot(sims)

Arguments

sims

output from sim.trials

Value

Error plots of estimated (1) percent allocation per dose, and (2) estimated response per dose.

Examples

# Number of pre-specified dose levels
dose <- 5 

# Vector of true toxicities associated with each dose
dose.tox <- c(0.05, 0.10, 0.20, 0.35, 0.45)       

# Acceptable (p_yes) and unacceptable (p_no) DLT rates used for establishing safety
p_no <- 0.40                                     
p_yes <- 0.15    

# Likelihood-ratio (LR) threshold
K <- 2                                          

# Cohort size used in stage 1
coh.size <- 3 

# Vector of true mean efficacies per dose (here mean T-cell persistence per dose (%))
m <- c(5, 15, 40, 65, 80)   # MUST BE THE SAME LENGTH AS dose.tox                  

# Efficacy (equal) variance per dose
v <- rep(0.01, 5) 

# Total sample size (stages 1&2)                            
N <- 25                                        

# Stopping rule
stop.rule <- 9   


numsims = 100

set.seed(1)
simulations = sim.trials(numsims = numsims, dose, dose.tox, p1 = p_no, p2 = p_yes, 
                         K, coh.size, m, v, N, stop.rule = stop.rule, cohort = 1, 
                         samedose = TRUE, nbb = 100)
                         
# sim.plot(simulations)

Visualize simulation results (Stages 1&2)

Description

Results from simulated trials (using sim.trials() function) displayed in tabular and/or graphical format

Usage

sim.summary(sims, print = TRUE)

Arguments

sims

output from sim.trials

print

logical specifying whether to print tables in console

Value

Printed tables and a list of the following objects:

  • pct.treated - IQR (25th percentile, median, 75th percentile) of percent of subjects treated at each dose level

  • efficacy - IQR of efficacy observed at each dose level

Examples

# Number of pre-specified dose levels
dose <- 5

# Vector of true toxicities associated with each dose
dose.tox <- c(0.05, 0.10, 0.20, 0.35, 0.45)      
 
# Acceptable (p_yes) and unacceptable (p_no) DLT rates used for establishing safety
p_no <- 0.40                                     
p_yes <- 0.15    

# Likelihood-ratio (LR) threshold
K <- 2                                          

# Cohort size used in stage 1
coh.size <- 3 

# Vector of true mean efficacies per dose (here mean percent persistence per dose)
m <- c(5, 15, 40, 65, 80)   # MUST BE THE SAME LENGTH AS dose.tox                  

# Efficacy(equal) variance per dose
v <- rep(0.01, 5) 

# Total sample size (stages 1&2)                            
N <- 25                                        

# Stopping rule: if dose 1 is the only safe dose, allocate up to 9 pts.
stop.rule <- 9 

simulations = sim.trials(numsims = 100, dose, dose.tox, p1 = p_no, p2 = p_yes, K, 
coh.size, m, v, N, stop.rule = stop.rule, cohort = 1, samedose = TRUE, nbb = 100)

summary = sim.summary(simulations)

Simulate full trial (both stages) x times

Description

Results are displayed in a matrix format, where each row represents one trial simulation.

Usage

sim.trials(
  numsims,
  dose,
  dose.tox,
  p1,
  p2,
  K,
  coh.size,
  m,
  v,
  N,
  stop.rule = 9,
  cohort = 1,
  samedose = TRUE,
  nbb = 100
)

Arguments

numsims

number of simulated trials

dose

number of doses to be tested (scalar)

dose.tox

vector of true toxicities for each dose. Values range from 0 - 1.

p1

toxicity under null (unsafe DLT rate). Values range from 0 - 1.

p2

toxicity under alternative (safe DLT rate). Values range from 0 - 1; p1 > p2

K

threshold for LR. Takes integer values: 1,2,...(recommended K=2)

coh.size

cohort size (number of patients) per dose (Stage 1)

m

vector of mean efficacies per dose. Values range from 0 - 100. (e.g, T cell persistence - values b/w 5 and 80 per cent)

v

vector of efficacy variances per dose. Values range from 0 - 1. (e.g., 0.01)

N

total sample size for stages 1&2

stop.rule

if only dose 1 safe, allocate up to 9 (default) patients at dose 1 to collect more info.

cohort

cohort size (number of patients) per dose (Stage 2). Default is 1.

samedose

designates whether the next patient is allocated to the same dose as the previous patient. Default is TRUE. Function adjusts accordingly.

nbb

binomial parameter (default = 100 cells per patient)

Value

List of the following objects:

  • sim.Y - estimated efficacy per each dose assignment

  • sim.d - dose assignment for each patient in the trial

  • safe.d - indicator of whether dose was declared safe

Examples

# Number of pre-specified dose levels
dose <- 5

# Vector of true toxicities associated with each dose
dose.tox <- c(0.05, 0.10, 0.20, 0.35, 0.45)       

# Acceptable (p_yes) and unacceptable (p_no) DLT rates used for establishing safety
p_no <- 0.40                                     
p_yes <- 0.15    

# Likelihood-ratio (LR) threshold
K <- 2                                          

# Cohort size used in stage 1
coh.size <- 3 

# Vector of true mean efficacies per dose (here mean percent persistence per dose)
m <- c(5, 15, 40, 65, 80)   # MUST BE THE SAME LENGTH AS dose.tox                  

# Efficacy(equal) variance per dose
v <- rep(0.01, 5) 

# Total sample size (stages 1&2)                            
N <- 25                                        

# Stopping rule: if dose 1 is the only safe dose, allocate up to 9 pts.
stop.rule <- 9 

sim.trials(numsims = 10, dose, dose.tox, p1 = p_no, p2 = p_yes, K, 
coh.size, m, v, N, stop.rule = stop.rule, cohort = 1, samedose = TRUE, nbb = 100)

Simulate full trial (both stages) x times when using nTTP to measure toxicity

Description

Results are displayed in a matrix format, where each row represents one trial simulation

Usage

sim.trials.nTTP(
  numsims,
  dose,
  p1,
  p2,
  K,
  coh.size,
  m,
  v,
  N,
  stop.rule = 9,
  cohort = 1,
  samedose = TRUE,
  nbb = 100,
  W,
  TOX,
  ntox,
  std.nTTP = 0.15
)

Arguments

numsims

number of simulated trials

dose

number of doses to be tested (scalar)

p1

toxicity under null (unsafe nTTP). Values range from 0 - 1.

p2

toxicity under alternative (safe nTTP). Values range from 0 - 1; p1 > p2

K

threshold for LR. Takes integer values: 1,2,...(recommended K=2)

coh.size

cohort size (number of patients) per dose (Stage 1)

m

vector of mean efficacies per dose. Values range from 0 - 100. (e.g, T cell persistence - values b/w 5 and 80 per cent)

v

vector of efficacy variances per dose. Values range from 0 - 1. (e.g., 0.01)

N

total sample size for stages 1&2

stop.rule

if only dose 1 safe, allocate up to 9 (default) patients at dose 1 to collect more info

cohort

cohort size (number of patients) per dose (Stage 2). Default is 1.

samedose

designates whether the next patient is allocated to the same dose as the previous patient. Default is TRUE. Function adjusts accordingly.

nbb

binomial parameter (default = 100 cells per patient)

W

matrix defining burden weight of each grade level for all toxicity types. The dimensions are ntox rows by 4 columns (for grades 0-4). See Ezzalfani et al. (2013) for details.

TOX

matrix array of toxicity probabilities. There should be ntox matrices. Each matrix represents one toxicity type, where probabilities of each toxicity grade are specified across each dose. Each matrix has the same dimensions: n rows, representing number of doses, and 5 columns (for grades 0-4). Probabilities across each dose (rows) must sum to 1. See Ezzalfani et al. (2013) for details.

ntox

number (integer) of different toxicity types

std.nTTP

the standard deviation of nTTP scores at each dose level (constant across doses)

Value

List of the following objects:

  • sim.Y - estimated efficacy per each dose assignment

  • sim.d - dose assignment for each patient in the trial

  • safe.d - indicator of whether dose was declared safe

Examples

# Number of pre-specified dose levels
dose <- 6     
 
# Acceptable (p2) and unacceptable nTTP values
p1 <- 0.35                                     
p2 <- 0.10     

# Likelihood-ratio (LR) threshold
K <- 2                                          

# Cohort size used in stage 1
coh.size <- 3 

# Total sample size (stages 1&2)                            
N <- 25 

# Efficacy (equal) variance per dose
v <- rep(0.01, 6)

# Dose-efficacy curve
m = c(10, 20, 30, 40, 70, 90)

# Number of toxicity types
ntox = 3

# Toxicity burden weight matrix
W = matrix(c(0, 0.5, 0.75, 1.0, 1.5, # Burden weight for grades 0-4 for toxicity 1
             0, 0.5, 0.75, 1.0, 1.5, # Burden weight for grades 0-4 for toxicity 2
             0, 0.00, 0.00, 0.5, 1), # Burden weight for grades 0-4 for toxicity 3
           nrow = ntox, byrow = TRUE)
           


# Standard deviation of nTTP values
std.nTTP = 0.15

# Array of toxicity event probabilities
TOX = array(NA, c(dose, 5, ntox)) 

TOX[, , 1] = matrix(c(0.823, 0.152, 0.022, 0.002, 0.001,
                      0.791, 0.172, 0.032, 0.004, 0.001,
                      0.758, 0.180, 0.043, 0.010, 0.009,
                      0.685, 0.190, 0.068, 0.044, 0.013,
                      0.662, 0.200, 0.078, 0.046, 0.014,
                      0.605, 0.223, 0.082, 0.070, 0.020),
                    nrow = 6, byrow = TRUE)
TOX[, , 2] = matrix(c(0.970, 0.027, 0.002, 0.001, 0.000,
                      0.968, 0.029, 0.002, 0.001, 0.000,
                      0.813, 0.172, 0.006, 0.009, 0.000,
                      0.762, 0.183, 0.041, 0.010, 0.004,
                      0.671, 0.205, 0.108, 0.011, 0.005,
                      0.397, 0.258, 0.277, 0.060, 0.008),
                    nrow = 6, byrow = TRUE)
TOX[, , 3] = matrix(c(0.930, 0.060, 0.005, 0.001, 0.004,
                      0.917, 0.070, 0.007, 0.001, 0.005,
                      0.652, 0.280, 0.010, 0.021, 0.037,
                      0.536, 0.209, 0.031, 0.090, 0.134,
                      0.015, 0.134, 0.240, 0.335, 0.276,
                      0.005, 0.052, 0.224, 0.372, 0.347),
                    nrow = 6, byrow = TRUE)

sim.trials.nTTP(numsims = 10, dose = dose, p1 = p1, p2 = p2, K = K, 
coh.size = coh.size, m = m, v = v, N = N, stop.rule = 9, cohort = 1, 
samedose = TRUE, nbb = 100, W = W, TOX = TOX, ntox = ntox, std.nTTP = std.nTTP)

Sample array of toxicity probabilities for 6 doses. Taken from Du et al.

Description

This is a sample array of toxicity probabilities to be used for trial simulations with nTTP as the toxicity endpoint. In this example, we have 3 toxicity types, 6 test doses, and 5 AE grades (0-4). See the nTTP_simulation_example vignette for more details.

Usage

data("TOX")

Format

The format is: num [1:6, 1:5, 1:3] 0.791 0.738 0.685 0.662 0.605 0.39 0.172 0.195 0.19 0.2 ...

Source

https://pubmed.ncbi.nlm.nih.gov/30403559/

Examples

data(TOX)
TOX

Generates DLTs and calculates the likelihood-ratio (LR) for each dose

Description

Gives toxicity profile (number of dose-limiting toxicities) and likelihood ratio per dose based on binary toxicity.

Usage

tox.profile(dose, dose.tox, p1, p2, K, coh.size)

Arguments

dose

number of doses to be tested (scalar)

dose.tox

vector of true toxicities for each dose. Values range from 0 - 1.

p1

toxicity under null (unsafe DLT rate). Values range from 0 - 1.

p2

toxicity under alternative (safe DLT rate). Values range from 0 - 1; p1 > p2

K

threshold for LR. Takes integer values: 1,2,...(recommended K=2)

coh.size

cohort size (number of patients) per dose (Stage 1)

Value

4-column matrix containing dose assignment, dose-limiting toxicities at each dose, cohort number, and likelihood ratio.

Examples

# Number of pre-specified dose levels
dose <- 5
# Vector of true toxicities associated with each dose
dose.tox <- c(0.05, 0.10, 0.20, 0.35, 0.45)       
# Acceptable (p2) and unacceptable (p1) DLT rates used for establishing safety
p1 <- 0.40                                     
p2 <- 0.15    

# Likelihood-ratio (LR) threshold
K <- 2                                          

# Cohort size used in stage 1
coh.size <- 3 

# Stopping rule: if dose 1 is the only safe dose, allocate up to 9 pts.
stop.rule <- 9 

tox.profile(dose = dose, dose.tox = dose.tox, p1 = p1, p2 = p2, K = K, coh.size = coh.size)

Generate nTTPs toxicity scores and the likelihhood-ratio (LR) per dose

Description

The normalized total toxicity profiles (nTTP) are calculated by combining multiple toxicity grades and their weights. The nTTPs are considered a quasi-continuous toxicity measure that follows a normal distribution truncated to [0, 1]. The likelihood ratio per dose are based on nTTP toxicity.

Usage

tox.profile.nTTP(dose, p1, p2, K, coh.size, ntox, W, TOX, std.nTTP = 0.15)

Arguments

dose

number of doses to be tested (scalar)

p1

toxicity under null (unsafe nTTP). Values range from 0 - 1.

p2

toxicity under alternative (safe nTTP). Values range from 0 - 1; p1 > p2

K

threshold for LR. Takes integer values: 1,2,...(recommended K=2)

coh.size

cohort size (number of patients) per dose (Stage 1)

ntox

number (integer) of different toxicity types (e.g, hematological, neurological, GI)

W

matrix defines burden weight of each grade level for all toxicity types. The dimensions are ntox rows by 5 columns (for grades 0-4). See Ezzalfani et al. (2013) for details.

TOX

matrix array of toxicity probabilities. There should be ntox matrices. Each matrix represents one toxicity type, where probabilities of each toxicity grade are specified across each dose. Each matrix has the same dimensions: n rows, representing number of doses, and 5 columns (for grades 0-4). Probabilities across each dose (rows) must sum to 1. See Ezzalfani et al. (2013) for details.

std.nTTP

the standard deviation of nTTP scores at each dose level (constant across doses)

Value

  • mnTTP - 4-column matrix containing dose assignment, mean nTTP at each dose, cohort number, and likelihood ratio.

  • all_nttp - all observed nTTP values

Examples

# Number of pre-specified dose levels
dose <- 6  
    
# Acceptable (p2) and unacceptable nTTP values
p1 <- 0.35                                     
p2 <- 0.10    

# Likelihood-ratio (LR) threshold
K <- 2                                          

# Cohort size used in stage 1
coh.size <- 3 

# Number of toxicity types
ntox <- 3

# Standard deviation of nTTP values
std.nTTP = 0.15
 
# Toxicity burden weight matrix
W = matrix(c(0, 0.5, 0.75, 1.0, 1.5, # Burden weight for grades 0-4 for toxicity 1
             0, 0.5, 0.75, 1.0, 1.5, # Burden weight for grades 0-4 for toxicity 2
             0, 0.00, 0.00, 0.5, 1), # Burden weight for grades 0-4 for toxicity 3
             nrow = ntox, byrow = TRUE)
           

# Array of toxicity event probabilities
TOX = array(NA, c(dose, 5, ntox)) 

TOX[, , 1] = matrix(c(0.823, 0.152, 0.022, 0.002, 0.001,  #prob of tox for dose 1 and tox type 1
                      0.791, 0.172, 0.032, 0.004, 0.001,  #prob of tox for dose 2 and tox type 1
                      0.758, 0.180, 0.043, 0.010, 0.009,  #prob of tox for dose 3 and tox type 1
                      0.685, 0.190, 0.068, 0.044, 0.013,  #prob of tox for dose 4 and tox type 1
                      0.662, 0.200, 0.078, 0.046, 0.014,  #prob of tox for dose 5 and tox type 1
                      0.605, 0.223, 0.082, 0.070, 0.020), #prob of tox for dose 6 and tox type 1
                      nrow = 6, byrow = TRUE)
TOX[, , 2] = matrix(c(0.970, 0.027, 0.002, 0.001, 0.000,  #prob of tox for dose 1 and tox type 2
                      0.968, 0.029, 0.002, 0.001, 0.000,  #prob of tox for dose 2 and tox type 2
                      0.813, 0.172, 0.006, 0.009, 0.000,  #prob of tox for dose 3 and tox type 2
                      0.762, 0.183, 0.041, 0.010, 0.004,  #prob of tox for dose 4 and tox type 2
                      0.671, 0.205, 0.108, 0.011, 0.005,  #prob of tox for dose 5 and tox type 2
                      0.397, 0.258, 0.277, 0.060, 0.008), #prob of tox for dose 6 and tox type 2
                      nrow = 6, byrow = TRUE)
TOX[, , 3] = matrix(c(0.930, 0.060, 0.005, 0.001, 0.004,  #prob of tox for dose 1 and tox type 3
                      0.917, 0.070, 0.007, 0.001, 0.005,  #prob of tox for dose 2 and tox type 3
                      0.652, 0.280, 0.010, 0.021, 0.037,  #prob of tox for dose 3 and tox type 3
                      0.536, 0.209, 0.031, 0.090, 0.134,  #prob of tox for dose 4 and tox type 3
                      0.015, 0.134, 0.240, 0.335, 0.276,  #prob of tox for dose 5 and tox type 3
                      0.005, 0.052, 0.224, 0.372, 0.347), #prob of tox for dose 6 and tox type 3
                      nrow = 6, byrow = TRUE)

tox.profile.nTTP(dose = dose, 
p1 = p1, 
p2 = p2, 
K = K, 
coh.size = coh.size, 
ntox = ntox, 
W = W, 
TOX = TOX, 
std.nTTP = std.nTTP)