Learn R Programming

PowerTOST (version 1.3-5)

sampleN.noninf: Sample size for the non-inferiority t-test

Description

Function for calculating the sample size needed to have a pre-specified power for the one-sided non-inferiority t-test for normal or log-normal distributed data.

Usage

sampleN.noninf(alpha = 0.025, targetpower = 0.8, logscale = TRUE, margin, 
               theta0, CV, design = "2x2", robust = FALSE, 
               details = FALSE, print = TRUE, imax=100)

Arguments

alpha
Type I error probability, significance level. Defaults here to 0.025.
targetpower
Power to achieve at least. Must be >0 and
logscale
Should the data used on log-transformed or on original scale? TRUE or FALSE. Defaults to TRUE.
margin
Non-inferiority margin. In case of logscale=TRUE it must be given as ratio, otherwise as diff. to 1. Defaults to 0.8 if logscale=TRUE or to -0.2 if logscale=FALSE.
theta0
'True' or assumed bioequivalence ratio or difference. In case of logscale=TRUE it must be given as ratio, otherwise as difference to 1. See examples. Defaults to 0.95 if logscale=TRUE or to 0.05 if logscale=FALSE
CV
Coefficient of variation as ratio. In case of cross-over studies this is the within-subject CV, in case of a parallel-group design the CV of the total variability.
design
Character string describing the study design. See known.designs for designs covered in this package.
robust
Defaults to FALSE. With that value the usual degrees of freedom will be used. Set to TRUE will use the degrees of freedom according to the 'robust' evaluation (aka Senn's basic estimator). These df are calculated as n-seq. See <
details
If TRUE the design characteristics and the steps during sample size calculations will be shown. Defaults to FALSE.
print
If TRUE (default) the function prints its results. If FALSE only the data.frame with the results will be returned.
imax
Maximum number of steps in sample size search. Defaults to 100. Adaption only in rare cases needed.

Value

  • A data.frame with the input and results will be returned. Explore it with str(sampleN.noninf(...)

Warning

The function does not vectorize properly. If you need sample sizes with varying CV's f.i. use for-loops or the apply-family.

Details

The sample size is calculated via iterative evaluation of power.noninf(). Start value for the sample size search is taken from a large sample approximation. The sample size is bound to 4 as minimum.

References

S.A. Julious "TUTORIAL IN BIOSTATISTICS Sample sizes for clinical trials with Normal data" Statist. Med. 2004; 23: 1921-1986

See Also

known.designs, power.noninf

Examples

Run this code
# using all the defaults: margin=0.8, theta0=0.95, alpha=0.025
# log-transformed, design="2x2"
sampleN.noninf(CV=0.3)
# should give n=48
#
# 'non-superiority' case, log-transformed data
# with assumed 'true' ratio somewhat above 1
sampleN.noninf(CV=0.3, targetpower=0.9, margin=1.25, theta0=1.05)
# should give n=62

Run the code above in your browser using DataLab