getPowerMeans {rpact} | R Documentation |
Get Power Means
Description
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 |
... |
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 |
normalApproximation |
The type of computation of the p-values. If |
meanRatio |
If |
thetaH0 |
The null hypothesis value,
default is
For testing a rate in one sample, a value |
alternative |
The alternative hypothesis value for testing means. This can be a vector of assumed
alternatives, default is |
stDev |
The standard deviation under which the sample size or power
calculation is performed, default is |
directionUpper |
Logical. Specifies the direction of the alternative,
only applicable for one-sided testing; default is |
maxNumberOfSubjects |
|
allocationRatioPlanned |
The planned allocation ratio |
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)
Value
Returns a TrialDesignPlan
object.
The following generics (R generic functions) are available for this result 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
.
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)