# power.TOST.sim

##### Power of the TOST procedure obtained via simulations

Power is calculated by simulations of studies (PE via its normal distribution,
MSE via its associated distribution) and application of the two one-sided *t*-tests. Power is obtained via ratio of studies found BE to
the number of simulated studies.

##### Usage

```
power.TOST.sim(alpha = 0.05, logscale = TRUE, theta1, theta2, theta0, CV, n,
design = "2x2", robust = FALSE, setseed = TRUE, nsims = 1e+05)
```

##### Arguments

- alpha
Type I error probability, significance level. By convention mostly set to 0.05.

- logscale
Should the data used on log-transformed or on original scale?

`TRUE`

(default) or`FALSE`

.- theta1
Lower bioequivalence limit. In case of

`logscale=TRUE`

it is given as ratio, otherwise as a difference to 1. Defaults to 0.8 if`logscale=TRUE`

or to -0.2 if`logscale=FALSE`

.- theta2
Upper bioequivalence limit. If not given theta2 will be calculated as

`1/theta1`

if`logscale=TRUE`

or as`-theta1`

if`logscale=FALSE`

.- theta0
‘True’ or assumed T/R ratio. 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 and in case of a parallel-group design the CV of the total variability.

- n
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

`n`

vector has to be equal to the number of (sequence) groups.- 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<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.- setseed
Simulations are dependent on the starting point of the (pseudo) random number generator. To avoid differences in power for different runs a

`set.seed(1234567)`

is issued if`setseed=TRUE`

, the default. Set this argument to`FALSE`

to view the variation in power between different runs.- nsims
Number of studies to simulate. Defaults to 100,000 = 1E5.

##### Value

Value of power according to the input arguments.

##### Note

This function was intended for internal check of the analytical power
calculation methods. Use of the analytical power calculation methods
(`power.TOST()`

) for real problems is recommended.
For sufficient precision nsims > 1E5 (default) may be necessary.
Be patient if using nsims=1E6. May take some seconds.

##### See Also

##### Examples

```
# NOT RUN {
# using the default design 2x2, BE range 0.8 ... 1.25, logscale, theta0=0.95
power.TOST.sim(alpha = 0.05, CV = 0.3, n = 12)
# should give 0.15054, with nsims=1E6 it will be 0.148533
# exact analytical is
power.TOST(alpha = 0.05, CV = 0.3, n = 12)
# should give 0.1484695
# very unusual alpha setting
power.TOST.sim(alpha = 0.9, CV = 0.3, n = 12)
# should give the same (within certain precision) as
power.TOST(alpha = 0.95, CV = 0.3, n = 12)
# or also within certain precision equal to
power.TOST(alpha = 0.95, CV = 0.3, n = 12, method = "mvt")
# SAS Proc Power gives here the incorrect value 0.60525
# }
```

*Documentation reproduced from package PowerTOST, version 1.4-9, License: GPL (>= 2)*