Skip to contents

Returns the simulated power, stopping probabilities, conditional power, and expected sample size for testing means rates for negative binomial distributed event numbers in the two treatment groups testing situation.

Usage

getSimulationCounts(
  design = NULL,
  ...,
  plannedCalendarTime,
  maxNumberOfSubjects = NA_real_,
  lambda1 = NA_real_,
  lambda2 = NA_real_,
  lambda = NA_real_,
  theta = NA_real_,
  directionUpper = TRUE,
  thetaH0 = 1,
  overdispersion = 0,
  fixedExposureTime = NA_real_,
  accrualTime = NA_real_,
  accrualIntensity = NA_real_,
  followUpTime = NA_real_,
  allocationRatioPlanned = NA_real_,
  maxNumberOfIterations = 1000L,
  seed = NA_real_,
  calcSubjectsFunction = 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 rate beta, twoSidedPower, and sided 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.

plannedCalendarTime

For simulating count data, the time points where an analysis is planned to be performed. Should be a vector of length kMax

maxNumberOfSubjects

maxNumberOfSubjects > 0 needs to be specified for power calculations or calculation of necessary follow-up (count data). For two treatment arms, it is the maximum number of subjects for both treatment arms.

lambda1

A numeric value or vector that represents the assumed rate of a homogeneous Poisson process in the active treatment group, there is no default.

lambda2

A numeric value that represents the assumed rate of a homogeneous Poisson process in the control group, there is no default.

lambda

A numeric value or vector that represents the assumed rate of a homogeneous Poisson process in the pooled treatment groups, there is no default.

theta

A numeric value or vector that represents the assumed mean ratios lambda1/lambda2 of a homogeneous Poisson process, there is no default.

directionUpper

Logical. Specifies the direction of the alternative, only applicable for one-sided testing; default is TRUE which means that larger values of the test statistics yield smaller p-values.

thetaH0

The null hypothesis value, default is 0 for the normal and the binary case (testing means and rates, respectively), it is 1 for the survival case (testing the hazard ratio).

For non-inferiority designs, thetaH0 is the non-inferiority bound. That is, in case of (one-sided) testing of

  • means: a value != 0 (or a value != 1 for testing the mean ratio) can be specified.

  • rates: a value != 0 (or a value != 1 for testing the risk ratio pi1 / pi2) can be specified.

  • survival data: a bound for testing H0: hazard ratio = thetaH0 != 1 can be specified.

  • count data: a bound for testing H0: lambda1 / lambda2 = thetaH0 != 1 can be specified.

For testing a rate in one sample, a value thetaH0 in (0, 1) has to be specified for defining the null hypothesis H0: pi = thetaH0.

overdispersion

A numeric value that represents the assumed overdispersion of the negative binomial distribution, default is 0.

fixedExposureTime

If specified, the fixed time of exposure per subject for count data, there is no default.

accrualTime

If specified, the assumed accrual time interval(s) for the study, there is no default.

accrualIntensity

If specified, the assumed accrual intensities for the study, there is no default.

followUpTime

If specified, the assumed (additional) follow-up time for the study, there is no default. The total study duration is accrualTime + followUpTime.

allocationRatioPlanned

The planned allocation ratio n1 / n2 for a two treatment groups design, default is 1. 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 length kMax, the number of stages. It can be a vector of length kMax, 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 internally allocationRatioPlanned is treated as a vector of length kMax, not a scalar.

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 and maxNumberOfSubjectsPerStage (see details and examples).

showStatistics

Logical. If TRUE, summary statistics of the simulated data are displayed for the print command, otherwise the output is suppressed, default is FALSE.

Value

Returns a SimulationResults object. The following generics (R generic functions) are available for this object:

Details

At given design the function simulates the power, stopping probabilities, conditional power, and expected sample size at given number of subjects and parameter configuration. Additionally, an allocation ratio = n1/n2 and a null hypothesis value thetaH0 can be specified.

Simulation Data

The summary statistics "Simulated data" contains the following parameters: median range; mean +/-sd

$show(showStatistics = FALSE) or $setShowStatistics(FALSE) can be used to disable the output of the aggregated simulated data.

Example 1:
simulationResults <- getSimulationRates(plannedSubjects = 40)
simulationResults$show(showStatistics = FALSE)

Example 2:
simulationResults <- getSimulationRates(plannedSubjects = 40)
simulationResults$setShowStatistics(FALSE)
simulationResults

getData() can be used to get the aggregated simulated data from the object as data.frame. The data frame contains the following columns:

  1. iterationNumber: The number of the simulation iteration.

  2. stageNumber: The stage.

  3. lambda1: The assumed or derived event rate in the treatment group (if available).

  4. lambda2: The assumed or derived event rate in the control group (if available).

  5. numberOfSubjects: The number of subjects under consideration when the (interim) analysis takes place.

  6. rejectPerStage: 1 if null hypothesis can be rejected, 0 otherwise.

  7. futilityPerStage: 1 if study should be stopped for futility, 0 otherwise.

  8. testStatistic: The test statistic that is used for the test decision, depends on which design was chosen (group sequential, inverse normal, or Fisher combination test)'

  9. testStatisticsPerStage: The test statistic for each stage if only data from the considered stage is taken into account.

  10. overallLambda1: The cumulative rate in treatment group 1.

  11. overallLambda2: The cumulative rate in treatment group 2.

  12. stagewiseLambda1: The stage-wise rate in treatment group 1.

  13. stagewiseLambda2: The stage-wise rate in treatment group 2.

  14. sampleSizesPerStage1: The stage-wise sample size in treatment group 1.

  15. sampleSizesPerStage2: The stage-wise sample size in treatment group 2.

  16. trialStop: TRUE if study should be stopped for efficacy or futility or final stage, FALSE otherwise.

  17. conditionalPowerAchieved: The conditional power for the subsequent stage of the trial for selected sample size and effect. The effect is either estimated from the data or can be user defined with lambda1H1 and lambda2H1.

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.