sampleN.RSABE2L.sdsims: Sample size estimation for BE Decision via Reference Scaled...

View source: R/sampleN.RSABE2L.sdsims.R

sampleN.RSABE2L.sdsimsR Documentation

Sample size estimation for BE Decision via Reference Scaled ABE


These functions performs the sample size estimation of the BE decision via the reference scaled ABE based on subject data simulations. Implemented are the methods ABEL, Hyslop and ‘exact’ (see the References in power.RSABE2L.sdsims).
The estimation method of the key statistics needed to perform the RSABE decision is the usual ANOVA.
This function has an alias sampleN.RSABE2L.sds().


sampleN.RSABE2L.sdsims(alpha = 0.05, targetpower = 0.8, theta0,
                       theta1, theta2, CV,
                       design = c("2x3x3", "2x2x4", "2x2x3"),
                       SABE_test = "exact", regulator, nsims=1e5,
                       nstart, imax = 100, print = TRUE,
                       details = TRUE, setseed = TRUE, progress)



Type I error probability. Per convention mostly set to 0.05.


Power to achieve at least. Must be >0 and <1.
Typical values are 0.8 or 0.9.


‘True’ or assumed T/R ratio.
Defaults to 0.90 according to the two Lászlós if not given explicitly.


Conventional lower ABE limit to be applied in the mixed procedure if CVsWR <= CVswitch.
Also Lower limit for the point estimate constraint.
Defaults to 0.8 if not given explicitly.


Conventional upper ABE limit to be applied in the mixed procedure if CVsWR <= CVswitch. Also upper limit for the point estimate constraint.
Defaults to 1.25 if not given explicitly.


Intra-subject coefficient(s) of variation as ratio (not percent).

  • If given as a scalar (length(CV)==1) the same CV of Test and Reference is assumed (homoscedasticity, CVwT==CVwR).

  • If given as a vector (length(CV)==2), i.e., assuming heteroscedasticity, the CV of the Test must be given in CV[1] and the one of the Reference in the CV[2].


Design of the study to be planned.
"2x3x3" is the partial replicate design.
"2x2x4" is a full replicate design with 2 sequences and 4 periods.
"2x2x3" is a full replicate design with 2 sequences and 3 periods.
Defaults to design="2x3x3". Details are given the section about Designs.


This argument specifies the test method to be used for the reference scaled ABE decision.
Default is the "exact" ‘ncTOST’ method of the two Laszlós. Other choices are "ABEL", "Hyslop" and "FDA". See Details.
This argument may be given also in lower case.


Regulatory settings for the widening of the BE acceptance limits.
May be given as character "EMA" or as an object of class 'regSet' (see reg_const).
Defaults to regulator="EMA" if missing.
This argument may be given also in lower case if given as character.
If given as object of class 'regSet' the component est_method can not be "ISC".


Number of simulations to be performed to obtain the (empirical) power. The default value 100,000 = 1e+5 is usually sufficient. Consider to rise this value if theta0<=0.85 or >=1.25. But see the warning section.


Set this to a start for the sample size search if a previous run failed.
After reworking the start n in version 1.1-05 rarely needed.


Maximum number of steps in sample size search. Defaults to 100.


If TRUE (default) the function prints its results. If FALSE only the result data.frame will be returned.


If set to TRUE (default), the steps during sample size search are shown.


Simulations are dependent on the starting point of the (pseudo) random number generator. To avoid differences in power for different runs a set.seed(123456) is issued if setseed=TRUE, the default.


Should a progressbar be shown? Defaults to TRUE if missing and nsims >5E5.


The methods rely on the analysis of log-transformed data, i.e., assume a log-normal distribution on the original scale.

The widened BE acceptance limits will be calculated by the formula
[L, U] = exp(± r_const * sWR)
with r_const the regulatory constant and sWR the standard deviation of the within subjects variability of the Reference. r_const = 0.76 (~log(1.25)/0.29356) is used in case of regulator="EMA". If the CVwR of the Reference is < CVswitch=0.3 the conventional ABE limits apply (mixed procedure).
In case of regulator="EMA" a cap is placed on the widened limits if CVwr>0.5, i.e., the widened limits are held at value calculated for CVwR=0.5.

The simulations are done by simulating subject data (all effects fixed except the residuals) and evaluating these data via ANOVA of all data to get the point estimate of T vs. R along with its 90% CI and an ANOVA of the data under R(eference) only to get an estimate of s2wR.

The estimated sample size gives always the total number of subjects (not subject/sequence – like in some other software packages).


Returns a data.frame with the input settings and sample size results.
The Sample size column contains the total sample size.
The nlast column contains the last n value. May be useful for restarting.


Although some designs are more ‘popular’ than others, sample size estimations are valid for all of the following designs:

"2x2x4" TRTR | RTRT
"2x2x3" TRT | RTR
"2x3x3" TRR | RTR | RRT


The sample size estimation for very extreme theta0 (<0.83 or >1.21) may be very time consuming and will eventually also fail since the start values chosen are not really reasonable in that ranges.
If you really need sample sizes in that range be prepared to restart the sample size estimation via the argument nstart.
Since the dependence of power from n is very flat in the mentioned region you may also consider to adapt the number of simulations not to tap in the simulation error trap.


We are doing the sample size estimation only for balanced designs since the break down of the total subject number in case of unbalanced sequence groups is not unique. Moreover the formulas used are only for balanced designs.
The minimum sample size is 6, even if the power is higher than the intended targetpower.

Subject simulations are relatively slow. Thus be patient and go for a cup of coffee if you use this function with high sample sizes!


H. Schütz

See Also

power.RSABE2L.sdsims, sampleN.scABEL, reg_const


# using the defaults:
# partial replicate design, targetpower=80%,
# true assumed ratio = 0.90, 1E+5 simulated studies
# ABE limits, PE constraint 0.8 - 1.25
# EMA regulatory settings
# compare results

CV     <- 0.4
method <- c("exact", "abel", "hyslop", "fda")
res    <- data.frame(SABE_test = c("ncTOST", "ABEL",
                                   "Hyslop", "FDA"),
                     n = NA, power = NA)
for (i in 1:nrow(res)) {
  res[i, 2:3] <- sampleN.RSABE2L.sdsims(CV = CV,
                                        SABE_test = method[i],
                                        details = FALSE,
                                        print = FALSE)[8:9]
print(res, digits = 4, row.names = FALSE)
# should result in a sample size n=48 with all methods,
# power=0.8197 (ncTOST), 0.8411 (ABEL), 0.8089 (Hyslop), 0.8113 (FDA)

PowerTOST documentation built on March 18, 2022, 5:47 p.m.