Function calculates of the power of the one-sided non-inferiority t-test for normal or log-normal distributed data.
power.noninf(alpha = 0.025, logscale = TRUE, margin, theta0, CV, n,
design = "2x2", robust = FALSE)
Type I error probability, significance level. Defaults here to 0.025.
Should the data used on log-transformed or on original scale? TRUE
(default) or FALSE
.
Non-inferiority margin.
In case of logscale=TRUE
it must be given as ratio, otherwise as difference to 1.
Defaults to 0.8 if logscale=TRUE
or to -0.2 if logscale=FALSE
.
‘True’ or assumed T/R ratio or difference (T--R).
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
.
Coefficient of variation as ratio. In case of cross-over studies this is the within-subject CV and in case of a parallel-group design the CV of the total variability.
Number of subjects under study.
Is total number if given as scalar, else number of subjects in the (sequence)
groups. In the latter case the length of the n
vector has to be equal to the
number of (sequence) groups.
Character string describing the study design.
See known.designs
for designs covered in this package.
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<U+2019>s basic estimator). These degrees of freedom are calculated as n-seq
.
See known.designs()$df2
for designs covered in this package.
Has only effect for higher-order crossover designs.
Value of power according to the input arguments.
The function does not vectorize if design is a vector. The function vectorize properly if CV or theta0 are vectors. Other vector input is not tested yet.
The power is calculated exact via non-central t-distribution.
Notes on the underlying hypotheses
If the supplied margin is < 0 (logscale=FALSE
) or < 1 (logscale=TRUE
),
then it is assumed higher response values are better. The hypotheses are
H0: theta0 <= margin vs. H1: theta0 > margin
where theta0 = mean(test)-mean(reference)
if logscale=FALSE
or
H0: log(theta0) <= log(margin) vs. H1: log(theta0) > log(margin)
where theta0 = mean(test)/mean(reference)
if logscale=TRUE
.
If the supplied margin is > 0 (logscale=FALSE
) or > 1 (logscale=TRUE
),
then it is assumed lower response values are better. The hypotheses are
H0: theta0 >= margin vs. H1: theta0 < margin
where theta0 = mean(test)-mean(reference)
if logscale=FALSE
or
H0: log(theta0) >= log(margin) vs. H1: log(theta0) < log(margin)
where theta0 = mean(test)/mean(reference)
if logscale=TRUE
.
This latter case may also be considered as ‘non-superiority’.
Julious SA. Sample sizes for clinical trials with Normal data. Stat Med. 2004;23(12):1921--86. 10.1002/sim.1783
# NOT RUN {
# using all the defaults: margin=0.8, theta0=0.95, alpha=0.025
# log-transformed, design="2x2"
# should give: 0.4916748
power.noninf(CV=0.3, n=24)
# }
Run the code above in your browser using DataLab