Get Simulation Multi-Arm Means
Source:R/f_simulation_multiarm_means.R
getSimulationMultiArmMeans.Rd
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.
Usage
getSimulationMultiArmMeans(
design = NULL,
...,
activeArms = 3L,
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_,
thetaH1 = NA_real_,
stDevH1 = NA_real_,
maxNumberOfIterations = 1000L,
seed = NA_real_,
calcSubjectsFunction = NULL,
selectArmsFunction = NULL,
showStatistics = FALSE
)
Arguments
- design
The trial design. If no trial design is specified, a fixed sample size design is used. In this case, Type I error rate
alpha
, Type II error ratebeta
,twoSidedPower
, andsided
can be directly entered as argument where necessary.- ...
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
3
.- effectMatrix
Matrix of effect sizes with
activeArms
columns and number of rows reflecting the different situations to consider.- typeOfShape
The shape of the dose-response relationship over the treatment groups. This can be either
"linear"
,"sigmoidEmax"
, or"userDefined"
, default is"linear"
.
For"linear"
,muMaxVector
specifies the range of effect sizes for the treatment group with highest response. If"sigmoidEmax"
is selected,gED50
andslope
has to be entered to specify the ED50 and the slope of the sigmoid Emax model. For"sigmoidEmax"
,muMaxVector
specifies the range of effect sizes for the treatment group with response according to infinite dose. If"userDefined"
is selected,effectMatrix
has to be entered.- muMaxVector
Range of effect sizes for the treatment group with highest response for
"linear"
and"sigmoidEmax"
model, default isseq(0, 1, 0.2)
.- gED50
If
typeOfShape = "sigmoidEmax"
is selected,gED50
has to be entered to specify the ED50 of the sigmoid Emax model.- slope
If
typeOfShape = "sigmoidEmax"
is selected,slope
can be entered to specify the slope of the sigmoid Emax model, default is 1.- doseLevels
The dose levels for the dose response relationship. If not specified, these dose levels are
1,...,activeArms
.- intersectionTest
Defines the multiple test for the intersection hypotheses in the closed system of hypotheses. Five options are available in multi-arm designs:
"Dunnett"
,"Bonferroni"
,"Simes"
,"Sidak"
, and"Hierarchical"
, default is"Dunnett"
.- stDev
The standard deviation under which the data is simulated, default is
1
. IfmeanRatio = TRUE
is specified,stDev
defines the coefficient of variationsigma / mu2
. Must be a positive numeric of length 1.- adaptations
A logical vector of length
kMax - 1
indicating whether or not an adaptation takes place at interim k, default isrep(TRUE, kMax - 1)
.- typeOfSelection
The way the treatment arms or populations are selected at interim. Five options are available:
"best"
,"rbest"
,"epsilon"
,"all"
, and"userDefined"
, default is"best"
.
For"rbest"
(select therValue
best treatment arms/populations), the parameterrValue
has to be specified, for"epsilon"
(select treatment arm/population not worse than epsilon compared to the best), the parameterepsilonValue
has to be specified. If"userDefined"
is selected,"selectArmsFunction"
or"selectPopulationsFunction"
has to be specified.- effectMeasure
Criterion for treatment arm/population selection, either based on test statistic (
"testStatistic"
) or effect estimate (difference for means and rates or ratio for survival) ("effectEstimate"
), default is"effectEstimate"
.- successCriterion
Defines when the study is stopped for efficacy at interim. Two options are available:
"all"
stops the trial if the efficacy criterion is fulfilled for all selected treatment arms/populations,"atLeastOne"
stops if at least one of the selected treatment arms/populations is shown to be superior to control at interim, default is"all"
.- epsilonValue
For
typeOfSelection = "epsilon"
(select treatment arm / population not worse than epsilon compared to the best), the parameterepsilonValue
has to be specified. Must be a numeric of length 1.- rValue
For
typeOfSelection = "rbest"
(select therValue
best treatment arms / populations), the parameterrValue
has to be specified.- threshold
Selection criterion: treatment arm / population is selected only if
effectMeasure
exceedsthreshold
, default is-Inf
.threshold
can also be a vector of lengthactiveArms
referring to a separate threshold condition over the treatment arms.- plannedSubjects
plannedSubjects
is a numeric vector of lengthkMax
(the number of stages of the design) that determines the number of cumulated (overall) subjects when the interim stages are planned. For two treatment arms, it is the number of subjects for both treatment arms. For multi-arm designs,plannedSubjects
refers to the number of subjects per selected active arm.- allocationRatioPlanned
The planned allocation ratio
n1 / n2
for a two treatment groups design, default is1
. For multi-arm designs, it is the allocation ratio relating the active arm(s) to the control. For simulating means and rates for a two treatment groups design, it can be a vector of lengthkMax
, the number of stages. It can be a vector of lengthkMax
, too, for multi-arm and enrichment designs. In these cases, a change of allocating subjects to treatment groups over the stages can be assessed. Note that internallyallocationRatioPlanned
is treated as a vector of lengthkMax
, not a scalar.- minNumberOfSubjectsPerStage
When performing a data driven sample size recalculation, the numeric vector
minNumberOfSubjectsPerStage
with lengthkMax
determines the minimum number of subjects per stage (i.e., not cumulated), the first element is not taken into account. For two treatment arms, it is the number of subjects for both treatment arms. For multi-arm designsminNumberOfSubjectsPerStage
refers to the minimum number of subjects per selected active arm.- maxNumberOfSubjectsPerStage
When performing a data driven sample size recalculation, the numeric vector
maxNumberOfSubjectsPerStage
with lengthkMax
determines the maximum number of subjects per stage (i.e., not cumulated), the first element is not taken into account. For two treatment arms, it is the number of subjects for both treatment arms. For multi-arm designsmaxNumberOfSubjectsPerStage
refers to the maximum number of subjects per selected active arm.- conditionalPower
If
conditionalPower
together withminNumberOfSubjectsPerStage
andmaxNumberOfSubjectsPerStage
(orminNumberOfEventsPerStage
andmaxNumberOfEventsPerStage
for survival designs) is specified, a sample size recalculation based on the specified conditional power is performed. It is defined as the power for the subsequent stage given the current data. By default, the conditional power will be calculated under the observed effect size. Optionally, you can also specifythetaH1
andstDevH1
(for simulating means),pi1H1
andpi2H1
(for simulating rates), orthetaH1
(for simulating hazard ratios) as parameters under which it is calculated and the sample size recalculation is performed.- 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
stDev
. Must be a positive numeric of length 1.- maxNumberOfIterations
The number of simulation iterations, default is
1000
. Must be a positive integer of length 1.- 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
minNumberOfSubjectsPerStage
andmaxNumberOfSubjectsPerStage
(see details and examples).- selectArmsFunction
Optionally, a function can be entered that defines the way of how treatment arms are selected. This function is allowed to depend on
effectVector
with lengthactiveArms
,stage
,conditionalPower
,conditionalCriticalValue
,plannedSubjects/plannedEvents
,allocationRatioPlanned
,selectedArms
,thetaH1
(for means and survival),stDevH1
(for means),overallEffects
, and for rates additionally:piTreatmentsH1
,piControlH1
,overallRates
, andoverallRatesControl
(see examples).- showStatistics
Logical. If
TRUE
, summary statistics of the simulated data are displayed for theprint
command, otherwise the output is suppressed, default isFALSE
.
Value
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 adata.frame
,as.matrix()
to coerce the object to amatrix
.
Details
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).
How to get help for generic functions
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
.
Examples
if (FALSE) { # \dontrun{
# 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)
} # }