Description Usage Arguments Value Functions Examples
This function determines the safety window length of the next cohort.
1 2 3 4 5 6 7 | windowLength(safetyWindow, size, ...)
## S4 method for signature 'SafetyWindowSize'
windowLength(safetyWindow, size, data, ...)
## S4 method for signature 'SafetyWindowConst'
windowLength(safetyWindow, size, ...)
|
safetyWindow |
The rule, an object of class
|
size |
The next cohort size |
... |
additional arguments |
data |
The data input, an object of class |
the windowLength
as a list of safety window parameters
(patientGap
, patientFollow
, patientFollowMin
)
windowLength,SafetyWindowSize-method
: Determine safety window length based
on the cohort size
windowLength,SafetyWindowConst-method
: Constant safety window length
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 | # nolint start
# Create the data
data <- DataDA(x=c(0.1, 0.5, 1.5, 3, 6, 10, 10, 10),
y=c(0, 0, 1, 1, 0, 0, 1, 0),
doseGrid=
c(0.1, 0.5, 1.5, 3, 6,
seq(from=10, to=80, by=2)),
u=c(42,30,15,5,20,25,30,60),
t0=c(0,15,30,40,55,70,75,85),
Tmax=60)
# Initialize the CRM model used to model the data
npiece_ <- 10
lambda_prior<-function(k){
npiece_/(data@Tmax*(npiece_-k+0.5))
}
model<-DALogisticLogNormal(mean=c(-0.85,1),
cov=matrix(c(1,-0.5,-0.5,1),nrow=2),
ref_dose=56,
npiece=npiece_,
l=as.numeric(t(apply(as.matrix(c(1:npiece_),1,npiece_),2,lambda_prior))),
C_par=2)
# Set-up some MCMC parameters and generate samples from the posterior
options <- McmcOptions(burnin=100,
step=2,
samples=200)
set.seed(94)
samples <- mcmc(data, model, options)
# Define the rule for dose increments and calculate the maximum dose allowed
myIncrements <- IncrementsRelative(intervals=c(0, 20),
increments=c(1, 0.33))
nextMaxDose <- maxDose(myIncrements,
data=data)
# Define the rule which will be used to select the next best dose
# based on the class 'NextBestNCRM'
myNextBest <- NextBestNCRM(target=c(0.2, 0.35),
overdose=c(0.35, 1),
maxOverdoseProb=0.25)
# Calculate the next best dose
doseRecommendation <- nextBest(myNextBest,
doselimit=nextMaxDose,
samples=samples, model=model, data=data)
# Define the rule which will be used to select the next cohort size
# based on the class 'CohortSizeConst'
mySize <- CohortSizeConst(size=3)
# Determine the cohort size for the next cohort
sizeRecommendation <- size(mySize, dose=doseRecommendation$value, data = data)
# Rule for the safety window length:
# -having patientGap as (0,7,3,3,...) for cohort size <4
# -and having patientGap as (0,9,5,5,...) for cohort size >=4
myWindowLength <- SafetyWindowSize(patientGap = list(c(7,3),c(9,5)),
sizeInterval = c(1,4),
patientFollow = 7,
patientFollowMin = 14)
# Determine the safety window parameters for the next cohort
windowLength(myWindowLength, size=sizeRecommendation)
# nolint end
# nolint start
# Create the data
data <- DataDA(x=c(0.1, 0.5, 1.5, 3, 6, 10, 10, 10),
y=c(0, 0, 1, 1, 0, 0, 1, 0),
doseGrid=
c(0.1, 0.5, 1.5, 3, 6,
seq(from=10, to=80, by=2)),
u=c(42,30,15,5,20,25,30,60),
t0=c(0,15,30,40,55,70,75,85),
Tmax=60)
# Initialize the CRM model used to model the data
npiece_ <- 10
lambda_prior<-function(k){
npiece_/(data@Tmax*(npiece_-k+0.5))
}
model<-DALogisticLogNormal(mean=c(-0.85,1),
cov=matrix(c(1,-0.5,-0.5,1),nrow=2),
ref_dose=56,
npiece=npiece_,
l=as.numeric(t(apply(as.matrix(c(1:npiece_),1,npiece_),2,lambda_prior))),
C_par=2)
# Set-up some MCMC parameters and generate samples from the posterior
options <- McmcOptions(burnin=100,
step=2,
samples=200)
set.seed(94)
samples <- mcmc(data, model, options)
# Define the rule for dose increments and calculate the maximum dose allowed
myIncrements <- IncrementsRelative(intervals=c(0, 20),
increments=c(1, 0.33))
nextMaxDose <- maxDose(myIncrements,
data=data)
# Define the rule which will be used to select the next best dose
# based on the class 'NextBestNCRM'
myNextBest <- NextBestNCRM(target=c(0.2, 0.35),
overdose=c(0.35, 1),
maxOverdoseProb=0.25)
# Calculate the next best dose
doseRecommendation <- nextBest(myNextBest,
doselimit=nextMaxDose,
samples=samples, model=model, data=data)
# Define the rule which will be used to select the next cohort size
# based on the class 'CohortSizeConst'
mySize <- CohortSizeConst(size=3)
# Determine the cohort size for the next cohort
sizeRecommendation <- size(mySize, dose=doseRecommendation$value, data = data)
# Rule for having safety window length with constant safety window parameters
myWindowLength <- SafetyWindowConst(patientGap = c(7,3),
patientFollow = 7,
patientFollowMin = 14)
# Determine the safety window parameters for the next cohort
windowLength(myWindowLength, size=sizeRecommendation)
# nolint end
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.