Skip to contents

Returns the power, stopping probabilities, and expected sample size for testing means in one or two samples at given maximum sample size.

Usage

getPowerMeans(
  design = NULL,
  ...,
  groups = 2L,
  normalApproximation = FALSE,
  meanRatio = FALSE,
  thetaH0 = ifelse(meanRatio, 1, 0),
  alternative = seq(0, 1, 0.2),
  stDev = 1,
  directionUpper = NA,
  maxNumberOfSubjects = NA_real_,
  allocationRatioPlanned = NA_real_
)

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.

groups

The number of treatment groups (1 or 2), default is 2.

normalApproximation

The type of computation of the p-values. If TRUE, the variance is assumed to be known, default is FALSE, i.e., the calculations are performed with the t distribution.

meanRatio

If TRUE, the sample size for one-sided testing of H0: mu1 / mu2 = thetaH0 is calculated, default is FALSE.

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.

alternative

The alternative hypothesis value for testing means. This can be a vector of assumed alternatives, default is seq(0, 1, 0.2) (power calculations) or seq(0.2, 1, 0.2) (sample size calculations).

stDev

The standard deviation under which the sample size or power calculation is performed, default is 1. If meanRatio = TRUE is specified, stDev defines the coefficient of variation sigma / mu2. Must be a positive numeric of length 1.

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.

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.

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.

Value

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

Details

At given design the function calculates the power, stopping probabilities, and expected sample size for testing means at given sample size. In a two treatment groups design, additionally, an allocation ratio = n1 / n2 can be specified where n1 and n2 are the number of subjects in the two treatment groups. A null hypothesis value thetaH0 != 0 for testing the difference of two means or thetaH0 != 1 for testing the ratio of two means can be specified. For the specified sample size, critical bounds and stopping for futility bounds are provided at the effect scale (mean, mean difference, or mean ratio, respectively)

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.

See also

Other power functions: getPowerCounts(), getPowerRates(), getPowerSurvival()

Examples

# Calculate the power, stopping probabilities, and expected sample size 
# for testing H0: mu1 - mu2 = 0 in a two-armed design against a range of 
# alternatives H1: mu1 - m2 = delta, delta = (0, 1, 2, 3, 4, 5), 
# standard deviation sigma = 8, maximum sample size N = 80 (both treatment 
# arms), and an allocation ratio n1/n2 = 2. The design is a three stage 
# O'Brien & Fleming design with non-binding futility bounds (-0.5, 0.5) 
# for the two interims. The computation takes into account that the t test 
# is used (normalApproximation = FALSE). 
getPowerMeans(getDesignGroupSequential(alpha = 0.025, 
    sided = 1, futilityBounds = c(-0.5, 0.5)), 
    groups = 2, alternative = c(0:5), stDev = 8,
    normalApproximation = FALSE, maxNumberOfSubjects = 80, 
    allocationRatioPlanned = 2)
#> Design plan parameters and output for means:
#> 
#> Design parameters:
#>   Information rates                            : 0.333, 0.667, 1.000 
#>   Critical values                              : 3.471, 2.454, 2.004 
#>   Futility bounds (binding)                    : -0.500, 0.500 
#>   Cumulative alpha spending                    : 0.0002592, 0.0071601, 0.0250000 
#>   Local one-sided significance levels          : 0.0002592, 0.0070554, 0.0225331 
#>   Significance level                           : 0.0250 
#>   Test                                         : one-sided 
#> 
#> User defined parameters:
#>   Alternatives                                 : 0, 1, 2, 3, 4, 5 
#>   Standard deviation                           : 8 
#>   Planned allocation ratio                     : 2 
#>   Maximum number of subjects                   : 80 
#> 
#> Default parameters:
#>   Mean ratio                                   : FALSE 
#>   Theta H0                                     : 0 
#>   Normal approximation                         : FALSE 
#>   Treatment groups                             : 2 
#>   Direction upper                              : TRUE 
#> 
#> Power and output:
#>   Effect                                       : 0, 1, 2, 3, 4, 5 
#>   Number of subjects [1]                       : 26.7 
#>   Number of subjects [2]                       : 53.3 
#>   Number of subjects [3]                       : 80 
#>   Number of subjects (1) [1]                   : 17.8 
#>   Number of subjects (1) [2]                   : 35.6 
#>   Number of subjects (1) [3]                   : 53.3 
#>   Number of subjects (2) [1]                   : 8.9 
#>   Number of subjects (2) [2]                   : 17.8 
#>   Number of subjects (2) [3]                   : 26.7 
#>   Overall reject                               : 0.02453, 0.07266, 0.17291, 0.33422, 0.53447, 0.72613 
#>   Reject per stage [1]                         : 0.0002592, 0.0007608, 0.0020525, 0.0050930, 0.0116360, 0.0245085 
#>   Reject per stage [2]                         : 0.0068984, 0.0206634, 0.0526503, 0.1146239, 0.2144384, 0.3472463 
#>   Reject per stage [3]                         : 0.0173692, 0.0512401, 0.1182075, 0.2145007, 0.3083936, 0.3543723 
#>   Overall futility stop                        : 0.70593, 0.54866, 0.38384, 0.23856, 0.13061, 0.06279 
#>   Futility stop per stage [1]                  : 0.30854, 0.21169, 0.13542, 0.08051, 0.04436, 0.02261 
#>   Futility stop per stage [2]                  : 0.39739, 0.33696, 0.24841, 0.15804, 0.08625, 0.04018 
#>   Early stop                                   : 0.7131, 0.5701, 0.4385, 0.3583, 0.3567, 0.4345 
#>   Expected number of subjects                  : 52.7, 59.1, 64.6, 68.2, 69, 67.2 
#>   Critical values (treatment effect scale) [1] : 13.113 
#>   Critical values (treatment effect scale) [2] : 5.905 
#>   Critical values (treatment effect scale) [3] : 3.864 
#>   Futility bounds (treatment effect scale) [1] : -1.664 
#>   Futility bounds (treatment effect scale) [2] : 1.169 
#>   Futility bounds (one-sided p-value scale) [1] : 0.6915 
#>   Futility bounds (one-sided p-value scale) [2] : 0.3085 
#> 
#> Legend:
#>   (i): values of treatment arm i
#>   [k]: values at stage k