getSimulationEnrichmentMeans {rpact}  R Documentation 
Returns the simulated power, stopping and selection probabilities, conditional power, and expected sample size or testing means in an enrichment design testing situation.
getSimulationEnrichmentMeans(
design = NULL,
...,
effectList = NULL,
intersectionTest = c("Simes", "SpiessensDebois", "Bonferroni", "Sidak"),
stratifiedAnalysis = TRUE,
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,
selectPopulationsFunction = 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. 
effectList 
List of subsets, prevalences, and effect sizes with columns and number of rows reflecting the different situations to consider (see examples). 
intersectionTest 
Defines the multiple test for the intersection
hypotheses in the closed system of hypotheses.
Four options are available in enrichment designs: 
stratifiedAnalysis 
Logical. For enrichment designs, typically a stratified analysis should be chosen.
For testing rates, also a nonstratified analysis based on overall data can be performed.
For survival data, only a stratified analysis is possible (see Brannath et al., 2009),
default is 
adaptations 
A logical vector of length 
typeOfSelection 
The way the treatment arms or populations are selected at interim.
Five options are available: 
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 
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 with specified

selectPopulationsFunction 
Optionally, a function can be entered that defines the way of how populations
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 population selection rule in the enrichment 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
,
selectedPopulations
,
plannedSubjects
,
allocationRatioPlanned
,
minNumberOfSubjectsPerStage
,
maxNumberOfSubjectsPerStage
,
conditionalPower
,
conditionalCriticalValue
,
overallEffects
, and
stDevH1
.
The function has to contain the threedots 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
.
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
.
# Assess a population selection strategy with one subset population.
# If the subset is better than the full population, then the subset
# is selected for the second stage, otherwise the full. Print and plot
# design characteristics.
# Define design
ds < getDesignInverseNormal(kMax = 2)
# Define subgroups and their prevalences
subGroups < c("S", "R") # fixed names!
prevalences < c(0.2, 0.8)
# Define effect matrix and variability
effectR < 0.2
m < c()
for (effectS in seq(0, 0.5, 0.25)) {
m < c(m, effectS, effectR)
}
effects < matrix(m, byrow = TRUE, ncol = 2)
stDev < c(0.4, 0.8)
# Define effect list
el < list(subGroups=subGroups, prevalences=prevalences, stDevs = stDev, effects = effects)
# Perform simulation
simResultsPE < getSimulationEnrichmentMeans(design = ds,
effectList = el, plannedSubjects = c(50, 100),
maxNumberOfIterations = 100)
print(simResultsPE)
# Assess the design characteristics of a user defined selection
# strategy in a threestage design with no interim efficacy stop
# using the inverse normal method for combining the stages.
# Only the second interim is used for a selecting of a study
# population. There is a small probability for stopping the trial
# at the first interim.
# Define design
ds < getDesignInverseNormal(typeOfDesign = "noEarlyEfficacy", kMax = 3)
# Define selection function
mySelection < function(effectVector, stage) {
selectedPopulations < rep(TRUE, 3)
if (stage == 2) {
selectedPopulations < (effectVector >= c(1, 2, 3))
}
return(selectedPopulations)
}
# Define subgroups and their prevalences
subGroups < c("S1", "S12", "S2", "R") # fixed names!
prevalences < c(0.2, 0.3, 0.4, 0.1)
effectR < 1.5
effectS12 = 5
m < c()
for (effectS1 in seq(0, 5, 1)) {
for (effectS2 in seq(0, 5, 1)) {
m < c(m, effectS1, effectS12, effectS2, effectR)
}
}
effects < matrix(m, byrow = TRUE, ncol = 4)
stDev < 10
# Define effect list
el < list(subGroups=subGroups, prevalences=prevalences, stDevs = stDev, effects = effects)
# Perform simulation
simResultsPE < getSimulationEnrichmentMeans(design = ds,
effectList = el,
typeOfSelection = "userDefined",
selectPopulationsFunction = mySelection,
intersectionTest = "Simes",
plannedSubjects = c(50, 100, 150),
maxNumberOfIterations = 100)
print(simResultsPE)
if (require(ggplot2)) plot(simResultsPE, type = 3)