View source: R/f_simulation_multiarm_means.R
| getSimulationMultiArmMeans | R Documentation |
Returns the simulated power, stopping and selection probabilities, conditional power, and expected sample size for testing means in a multi-arm treatment groups testing situation.
getSimulationMultiArmMeans(
design = NULL,
...,
activeArms = NA_integer_,
effectMatrix = NULL,
typeOfShape = c("linear", "sigmoidEmax", "userDefined"),
muMaxVector = seq(0, 1, 0.2),
gED50 = NA_real_,
slope = 1,
doseLevels = NA_real_,
intersectionTest = c("Dunnett", "Bonferroni", "Simes", "Sidak", "Hierarchical"),
stDev = 1,
adaptations = NA,
typeOfSelection = c("best", "rBest", "epsilon", "all", "userDefined"),
effectMeasure = c("effectEstimate", "testStatistic"),
successCriterion = c("all", "atLeastOne"),
epsilonValue = NA_real_,
rValue = NA_real_,
threshold = -Inf,
plannedSubjects = NA_integer_,
allocationRatioPlanned = NA_real_,
minNumberOfSubjectsPerStage = NA_real_,
maxNumberOfSubjectsPerStage = NA_real_,
conditionalPower = NA_real_,
thetaH0 = C_THETA_H0_MEANS_DEFAULT,
thetaH1 = NA_real_,
stDevH1 = NA_real_,
maxNumberOfIterations = NA_integer_,
seed = NA_real_,
calcSubjectsFunction = NULL,
selectArmsFunction = NULL,
showStatistics = FALSE
)
design |
The trial design. If no trial design is specified, a fixed sample size design is used.
In this case, Type I error rate |
... |
Ensures that all arguments (starting from the "...") are to be named and that a warning will be displayed if unknown arguments are passed. |
activeArms |
The number of active treatment arms to be compared with control, default is |
effectMatrix |
Matrix of effect sizes with |
typeOfShape |
The shape of the dose-response relationship over the treatment groups.
This can be either |
muMaxVector |
Range of effect sizes for the treatment group with highest response
for |
gED50 |
If |
slope |
If |
doseLevels |
The dose levels for the dose response relationship.
If not specified, these dose levels are |
intersectionTest |
Defines the multiple test for the intersection
hypotheses in the closed system of hypotheses.
Five options are available in multi-arm designs: |
stDev |
The standard deviation under which the data is simulated,
default is |
adaptations |
A logical vector of length |
typeOfSelection |
Rule for selecting treatment arms (multi-arm designs) or
populations (enrichment designs) for continuation after an interim analysis.
The default |
effectMeasure |
Criterion for treatment arm/population selection, either based on test statistic
( |
successCriterion |
Defines when the study is stopped for efficacy at interim.
Two options are available: |
epsilonValue |
For |
rValue |
For |
threshold |
Selection criterion: treatment arm / population is selected only if |
plannedSubjects |
|
allocationRatioPlanned |
The planned allocation ratio |
minNumberOfSubjectsPerStage |
When performing a data driven sample size recalculation,
the numeric vector |
maxNumberOfSubjectsPerStage |
When performing a data driven sample size recalculation,
the numeric vector |
conditionalPower |
If |
thetaH0 |
The null hypothesis value,
default is
For testing a rate in one sample, a value |
thetaH1 |
If specified, the value of the alternative under which the conditional power or sample size recalculation calculation is performed. Must be a numeric of length 1. |
stDevH1 |
If specified, the value of the standard deviation under which
the conditional power or sample size recalculation calculation is performed,
default is the value of |
maxNumberOfIterations |
The number of simulation iterations, default is |
seed |
The seed to reproduce the simulation, default is a random seed. |
calcSubjectsFunction |
Optionally, a function can be entered that defines the way of performing the sample size
recalculation. By default, sample size recalculation is performed with conditional power and specified
|
selectArmsFunction |
Optionally, a function can be entered that defines the way of how treatment arms
are selected. This function is allowed to depend on |
showStatistics |
Logical. If |
At given design the function simulates the power, stopping probabilities, selection probabilities, and expected sample size at given number of subjects, parameter configuration, and treatment arm selection rule in the multi-arm situation. An allocation ratio can be specified referring to the ratio of number of subjects in the active treatment groups as compared to the control group.
The definition of thetaH1 and/or stDevH1 makes only sense if kMax > 1
and if conditionalPower, minNumberOfSubjectsPerStage, and
maxNumberOfSubjectsPerStage (or calcSubjectsFunction) are defined.
calcSubjectsFunction
This function returns the number of subjects at given conditional power and conditional
critical value for specified testing situation. The function might depend on the variables
stage,
selectedArms,
plannedSubjects,
allocationRatioPlanned,
minNumberOfSubjectsPerStage,
maxNumberOfSubjectsPerStage,
conditionalPower,
conditionalCriticalValue,
overallEffects, and
stDevH1.
The function has to contain the three-dots argument '...' (see examples).
Returns a SimulationResults object.
The following generics (R generic functions) are available for this object:
names() to obtain the field names,
print() to print the object,
summary() to display a summary of the object,
plot() to plot the object,
as.data.frame() to coerce the object to a data.frame,
as.matrix() to coerce the object to a matrix.
Selection determines which treatment arms or populations continue to the next
stage. It is applied at interim analysis k only if
adaptations[k] = TRUE; the default enables selection at every interim.
Otherwise, the current selection is retained. Once dropped, an arm or
population cannot be selected again. In multi-arm designs, these rules apply
to the active treatment arms; the control group is retained.
The ranking uses the cumulative interim data and the criterion specified by
effectMeasure: the estimated treatment effect for
"effectEstimate" (the default), or the test statistic for
"testStatistic". The selection functions use a vector
effectVector on a scale where larger values rank better. For survival
endpoints with effectMeasure = "effectEstimate", this is the estimated
hazard ratio for directionUpper = TRUE and its reciprocal for
directionUpper = FALSE.
"best" (default)Selects only the single best remaining arm or population. Thus, with three active arms and selection enabled at the first interim, only one arm continues to stage 2. It does not drop just the worst arm. If several have the same best value, the first in the original order is selected.
"rBest"Selects the rValue highest-ranked remaining
arms or populations, subject to availability. Specify rValue as a
positive integer. For example, rValue = 2 selects the best two;
rValue = 1 gives the same selection as "best".
The same rValue is used at every enabled interim, so this option
does not mean dropping one arm or population at each interim.
The spelling "rbest" is also accepted.
"epsilon"Selects the best and all other remaining arms or
populations whose selection value is at most epsilonValue below
the best value, including equality. Specify epsilonValue on the
scale of effectVector. The number selected depends on the observed
differences and can vary between simulation runs. For example, selection
values c(0.20, 0.35, 0.40) and epsilonValue = 0.10 retain
the second and third arms or populations. For response-rate differences,
0.10 represents 10 percentage points.
"all"Retains all remaining arms or populations without ranking them. This disables dropping based on relative performance, but threshold conditions and stopping rules still apply.
"userDefined"Uses selectArmsFunction in multi-arm
designs or selectPopulationsFunction in enrichment designs.
Supply a function returning a logical vector in the original arm or
population order, with TRUE indicating selection. Its length must
equal the original number of active arms or populations. The function
can use stage, effectVector, and the other arguments listed
in the corresponding parameter description. Use this option for rules
whose number selected changes by stage, such as dropping the worst
remaining arm at each interim.
For the four built-in rules, selected arms or populations must additionally
have a selection value strictly above threshold. The default
threshold = -Inf imposes no additional restriction. Consequently,
fewer than the requested number may continue, or none may continue.
For "userDefined", implement any threshold condition in the supplied
function. Efficacy and futility stopping rules apply separately from selection.
For example, the following multi-arm selection function drops one worst
remaining arm at each enabled interim, while retaining at least one arm.
Pass it as selectArmsFunction = dropWorstArm together with
typeOfSelection = "userDefined". If three arms are still available
at the first interim, it retains two; at the next enabled interim it retains
one, provided the trial continues.
dropWorstArm <- function(effectVector, selectedArms, stage) {
keep <- selectedArms[seq_along(effectVector), stage] & !is.na(effectVector)
if (sum(keep) > 1L) {
remaining <- which(keep)
worst <- remaining[which.min(effectVector[remaining])]
keep[worst] <- FALSE
}
keep
}
Click on the link of a generic in the list above to go directly to the help documentation of
the rpact specific implementation of the generic.
Note that you can use the R function methods to get all the methods of a generic and
to identify the object specific name of it, e.g.,
use methods("plot") to get all the methods for the plot generic.
There you can find, e.g., plot.AnalysisResults and
obtain the specific help documentation linked above by typing ?plot.AnalysisResults.
## Not run:
# Assess a treatment-arm selection strategy with three active arms,
# if the better of the arms is selected for the second stage, and
# compare it with the no-selection case.
# Assume a linear dose-response relationship
maxNumberOfIterations <- 100
designIN <- getDesignInverseNormal(typeOfDesign = "OF", kMax = 2)
sim <- getSimulationMultiArmMeans(design = designIN,
activeArms = 3, typeOfShape = "linear",
muMaxVector = seq(0,0.8,0.2),
intersectionTest = "Simes",
typeOfSelection = "best",
plannedSubjects = c(30,60),
maxNumberOfIterations = maxNumberOfIterations)
sim0 <- getSimulationMultiArmMeans(design = designIN,
activeArms = 3, typeOfShape = "linear",
muMaxVector = seq(0,0.8,0.2),
intersectionTest = "Simes",
typeOfSelection = "all",
plannedSubjects = c(30,60),
maxNumberOfIterations = maxNumberOfIterations)
sim$rejectAtLeastOne
sim$expectedNumberOfSubjects
sim0$rejectAtLeastOne
sim0$expectedNumberOfSubjects
# Compare the power of the conditional Dunnett test with the power of the
# combination test using Dunnett's intersection tests if no treatment arm
# selection takes place. Asseume a linear dose-response relationship.
maxNumberOfIterations <- 100
designIN <- getDesignInverseNormal(typeOfDesign = "asUser",
userAlphaSpending = c(0, 0.025))
designCD <- getDesignConditionalDunnett(secondStageConditioning = TRUE)
index <- 1
for (design in c(designIN, designCD)) {
results <- getSimulationMultiArmMeans(design, activeArms = 3,
muMaxVector = seq(0, 1, 0.2), typeOfShape = "linear",
plannedSubjects = cumsum(rep(20, 2)),
intersectionTest = "Dunnett",
typeOfSelection = "all", maxNumberOfIterations = maxNumberOfIterations)
if (index == 1) {
drift <- results$effectMatrix[nrow(results$effectMatrix), ]
plot(drift, results$rejectAtLeastOne, type = "l", lty = 1,
lwd = 3, col = "black", ylab = "Power")
} else {
lines(drift,results$rejectAtLeastOne, type = "l",
lty = index, lwd = 3, col = "red")
}
index <- index + 1
}
legend("topleft", legend=c("Combination Dunnett", "Conditional Dunnett"),
col=c("black", "red"), lty = (1:2), cex = 0.8)
# Assess the design characteristics of a user defined selection
# strategy in a two-stage design using the inverse normal method
# with constant bounds. Stopping for futility due to
# de-selection of all treatment arms.
designIN <- getDesignInverseNormal(typeOfDesign = "P", kMax = 2)
mySelection <- function(effectVector) {
selectedArms <- (effectVector >= c(0, 0.1, 0.3))
return(selectedArms)
}
results <- getSimulationMultiArmMeans(designIN, activeArms = 3,
muMaxVector = seq(0, 1, 0.2),
typeOfShape = "linear",
plannedSubjects = c(30,60),
intersectionTest = "Dunnett",
typeOfSelection = "userDefined",
selectArmsFunction = mySelection,
maxNumberOfIterations = 100)
options(rpact.summary.output.size = "medium")
summary(results)
if (require(ggplot2)) plot(results, type = c(5,3,9), grid = 4)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.