-
Notifications
You must be signed in to change notification settings - Fork 2
/
README.Rmd
231 lines (192 loc) · 12.4 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
---
title: "Power2Stage"
output:
github_document:
toc: true
toc_depth: 4
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
[![License: GPL v3](https://img.shields.io/badge/License-GPLv2-blue.svg)](https://www.gnu.org/licenses/gpl-2.0) [![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0) ![active](https://www.repostatus.org/badges/latest/active.svg) ![repo size](https://img.shields.io/github/repo-size/Detlew/Power2Stage?color=yellow) ![code size](https://img.shields.io/github/languages/code-size/Detlew/PowerTOST?color=green) ![first](https://img.shields.io/badge/CRAN%20since-Jan%202014-brightgreen) ![on CRAN](https://www.r-pkg.org/badges/version-ago/Power2Stage) [![cran checks](https://cranchecks.info/badges/worst/Power2Stage)](https://cran.r-project.org/web/checks/check_results_Power2Stage.html) ![commits](https://img.shields.io/github/commits-since/Detlew/Power2Stage/latest) [![CRAN RStudio mirror downloads](https://cranlogs.r-pkg.org/badges/grand-total/Power2Stage?color=blue)](https://r-pkg.org/pkg/Power2Stage) [![CRAN RStudio mirror downloads](https://cranlogs.r-pkg.org/badges/last-month/Power2Stage?color=green)](https://r-pkg.org/pkg/Power2Stage)
```{r, echo = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#"
)
```
The package contains functions to obtain the operational characteristics (power, type I error, percentage of studies proceeding to the second stage, average and quantiles of total sample sizes) of bioequivalence studies in adaptive sequential Two-Stage Designs (TSD) via simulations.
```{r, echo = FALSE, results = "asis"}
txt <- paste0("Version ", packageVersion("Power2Stage"), " built ",
packageDate("Power2Stage", date.fields = "Built"),
" with R ", substr(packageDescription("Power2Stage", fields = "Built"), 3, 7))
if (grepl("900", as.character(packageVersion("Power2Stage")))) {
txt <- paste(txt, "\n(development version not on CRAN).")
} else {
txt <- paste0(txt, "\n(stable release on CRAN ",
packageDate("Power2Stage", date.fields = "Date/Publication"), ").")
}
cat(txt)
```
## Supported Methods
### Simulation-based
Since the many letters denoting the methods given by various authors might be confusing, [I classified](https://doi.org/10.1007/s00228-015-1806-2) the methods as two ‘types’:
- **‘Type 1’**\
An adjusted *α* is used *both* in the interim as well as in the final analysis of pooled data.
- **‘Type 2’**\
Whether an unadjusted or an adjusted *α* is used depends on interim power. An adjusted *α* is used in the final analysis of pooled data.
It should be noted that the adjusted alphas do not necessarily have to be the same in both stages. Below a summary of conditions used in the decision schemes of the published methods.
<small>[TOC ↩](#power2stage)</small>
#### ‘Type 1’
- [Potvin *et al.*](https://doi.org/10.1002/pst.294) (2008) ‘Method B’: *α* 0.0294 (*θ*~0~ 0.95, target power 0.80).
- [Fuglsang](https://doi.org/10.1208/s12248-013-9475-5) (2013) ‘Method B’: *α* 0.0284 (*θ*~0~ 0.95, target power 0.90).
- [Karalis](https://doi.org/10.1016/j.ijpharm.2013.08.013) (2013) ‘TSD-2’: *α* 0.0294 (*θ*~0~ = PE, target power 0.80).
- [Fuglsang](https://doi.org/10.1208/s12248-014-9571-1) (2014) ‘Method B’ (parallel design): *α* 0.0294 (*θ*~0~ 0.95, target power 0.80).
- [Zheng *et al.*](https://doi.org/10.1002/pst.1672) (2015) ‘MSDBE’: *α*~1~ 0.01, *α*~2~ 0.04.
- [Xu *et al.*](https://doi.org/10.1002/pst.1721) (2016) ‘Method E’: (*θ*~0~ 0.95, target power 0.80, *n*~max~ 42).\
- For *CV* 10--30%\
*α*~1~ 0.0294, *α*~2~ 0.0357, futility rule on CI {0.9374, 1/0.9374}.
- For *CV* 30--55%\
*α*~1~ 0.0254, *α*~2~ 0.0363, futility rule on CI {0.9305, 1/0.9305}.
- [Molins *et al.*](https://doi.org/10.1002/sim.7452) (2017) ‘Type 1 modified Potvin B’: *α* 0.0301 (*θ*~0~ 0.95, target power 0.80, min. *n~2~* = 1.5*n~1~*, *n~max~* 150).
#### ‘Type 2’
- [Potvin *et al.*](https://doi.org/10.1002/pst.294) (2008) ‘Method C’: *α* 0.0294 (*θ*~0~ 0.95, target power 0.80).
- [Montague *et al.*](https://doi.org/10.1002/pst.483) (2011) ‘Method D’: *α* 0.0280 (*θ*~0~ 0.90, target power 0.80).
- [Fuglsang](https://doi.org/10.1208/s12248-013-9475-5) (2013) ‘Method C/D’:\
*α* 0.0274 (*θ*~0~ 0.95, target power 0.90).\
*α* 0.0269 (*θ*~0~ 0.90, target power 0.90).
- [Karalis and Macheras](https://doi.org/10.1007/s11095-013-1026-3) (2013) ‘TSD’: *α* 0.0294 (*θ*~0~ = PE, target power 0.80).
- [Karalis](https://doi.org/10.1016/j.ijpharm.2013.08.013) (2013) ‘TSD-1’: *α* 0.0280 (*θ*~0~ = PE, target power 0.80).
- [Xu *et al.*](https://doi.org/10.1002/pst.1721) (2016) ‘Method F’: (*θ*~0~ 0.95, target power 0.80, *n~max~* 180).\
- For *CV* 10--30%\
*α*~1~ 0.0248, *α*~2~ 0.0364, futility rule on CI {0.9492, 1/0.9492}.
- For *CV* 30--55%\
*α*~1~ 0.0259, *α*~2~ 0.0349, futility rule on CI {0.9350, 1/0.9350}.
- [Molins *et al.*](https://doi.org/10.1002/sim.7452) (2017) ‘Type 2 modified Potvin C’: *α* 0.0280 (*θ*~0~ 0.95, target power 0.80, min. *n~2~* = 1.5*n~1~*, *n~max~* 150).
#### Blinded Sample Size Re-estimation in the Interim
[Golkowski *et al.*](https://doi.org/10.1002/pst.1617) (2014).
#### Group Sequential Design
[Kieser and Rauch](https://doi.org/10.1002/sim.6487) (2015).
### Inverse-Normal Combination
[König *et al.*](https://doi.org/10.13140/RG.2.1.5190.0967) (2014), [Kieser and Rauch](https://doi.org/10.1002/sim.6487) (2015),
[Wassmer and Brannath](https://doi.org/10.1007/978-3-319-32562-0) (2016), [Maurer *et al.*](https://doi.org/10.1002/sim.7614) (2018).
<small>[TOC ↩](#power2stage)</small>
## Functions
### Main
Defaults employed if not specified in the function call:
|function|`theta0`|`target power`|`usePE`|`Nmax`|`max.n`|`fCrit`|`fClower`|
|-|:-:|:-:|:-:|:-:|:-:|:-:|:-:|
|`power.tsd()`|`0.95`|`0.80`|`FALSE`|`Inf`|--|--|--|
|`power.tsd.fC()`|`0.95`|`0.80`|`FALSE`|--|`Inf`|`"PE"`|`0.80`|
|`power.tsd.KM()`|`0.95`|`0.80`|--|`150`|--|--|--|
|`power.tsd.ssr()`|`0.95`|`0.80`|`FALSE`|--|`Inf`|--|--|
|`power.tsd.GS()`|`0.95`|--|--|--|--|`"PE"`|`0.80`|
|`power.tsd.in()`|`0.95`|`0.80`|`FALSE`|--|`Inf`|`"CI"`|`0.95`|
|`power.tsd.p()`|`0.95`|`0.80`|`FALSE`|`Inf`|--|--|--|
All functions are for a 2×2×2 crossover design except `power.tsd.p()`, which is for a two-group parallel design.\
If `usePE = TRUE` the point estimate in the interim is used in sample size estimation of the second stage.\
If the estimated total sample size exceeds `max.n` the second stage will be forced to `max.n - n1` (*i.e.*, it is *not* a futility criterion).\
The method used for interim power and sample size estimation is specified by the argument `pmethod`. It defaults to `"nct"` (approximation by the noncentral *t*-distribution) except in `power.tsd.GS()`, where the total sample size is already fixed.\
The BE limits are specified by the arguments `theta1` and `theta2` (default to 0.80 and 1.25).\
The number of simulations is specified by the argument `nsims`. It defaults to 1e5 if simulating power and to 1e6 if simulating the empiric type I error (*i.e.*, `theta0` set to the value of `theta1` or `theta2`).
**Futility Criteria in the Interim**
- `Nmax`: The study will stop if the estimated total sample size exceeds `Nmax`.
- `fCrit` (`"PE"` or `"CI"`): The study will stop if outside `fClower` and `1/fClower`.
- `"PE"`: `fClower` defaults to 0.80.
- `"CI"`: `fClower` defaults to 0.925 (except in function `power.tsd.in()`, where it defaults to 0.95).
<small>[TOC ↩](#power2stage)</small>
### Helpers
- `sampleN2.TOST()`\
Estimates the sample size of stage 2 to achieve at least the target power.
- `interim.tsd.in()`\
Interim analysis based on the Inverse-Normal Combination method.
- `final.tsd.in()`\
Final analysis based on the Inverse-Normal Combination method.
<small>[TOC ↩](#power2stage)</small>
## Examples
Before running the examples attach the library.
```{r attach_library}
library(Power2Stage)
```
If not noted otherwise, defaults are employed.
### Method B
Power estimation by the shifted central *t*-distribution.
```{r methodB_exp1}
power.tsd(CV = 0.20, n1 = 12, pmethod = "shifted")
```
Explore the empiric type I error at the upper BE-limit.
```{r methodB_exp2}
power.tsd(CV = 0.20, n1 = 12, pmethod = "shifted",
theta0 = 1.25)[["pBE"]]
```
<small>[TOC ↩](#power2stage)</small>
### Method C
Power estimation by the shifted central *t*-distribution.
```{r methodC_exp1}
power.tsd(method = "C", CV = 0.20, n1 = 12, pmethod = "shifted")
```
Slightly better than ‘Method B’ in terms of power in both stages and fewer studies are expected to proceed to the second stage.
Explore the empiric type I error at the upper BE-limit (1 milion simulations).
```{r methodC_exp2}
power.tsd(method = "C", CV = 0.20, n1 = 12, pmethod = "shifted",
theta0 = 1.25)[["pBE"]]
```
Slight inflation of the type I error (although considered negligible by the authors). However, more adjustment (adjusted *α* 0.0280) controls the type I error.
```{r methodC_exp3}
power.tsd(method = "C", alpha = rep(0.0280, 2), CV = 0.20,
n1 = 12, pmethod = "shifted", theta0 = 1.25)[["pBE"]]
```
<small>[TOC ↩](#power2stage)</small>
### Inverse-Normal Combination
Data given by Potvin *et al.* in Example 2: 12 subjects in stage 1, PE 1.0876, CV 0.18213, all defaults of the function used.
```{r inc_interim}
interim.tsd.in(GMR = 0.95, GMR1 = 1.0876, CV1 = 0.18213, n1 = 12)
```
The second stage should be initiated with 6 subjects. Note that with `interim.tsd.in(..., fCrit = "No", ssr.conditional = "no")` 8 subjects would be required like in the Methods of Potvin *et al.*
The second stage is performed in 8 subjects, PE 0.9141, CV 0.25618.
```{r inc_final}
final.tsd.in(GMR1 = 1.0876, CV1 = 0.18213, n1 = 12,
GMR2 = 0.9141, CV2 = 0.25618, n2 = 8)
```
The study passed with a (repeated) CI of 87.69--117.36%. Although slightly more conservative, same conclusion like based on the 94.12% CI of 88.45--116.38% reported by Potvin *et al.*
<small>[TOC ↩](#power2stage)</small>
## Speed Comparisons
Performed on a Xeon E3-1245v3 3.4 GHz, 8 MB cache, 16 GB RAM, R `r getRversion()` on Windows 7.
‘Method B’ (*CV* 0.20, *n*~1~ 12).
```
# method power seconds
# shifted 0.84454 1.09
# nct 0.84266 1.61
# exact 0.84260 31.98
```
Despite being the fastest, the shifted central *t*-distribution should only be used in order to compare with published methods. The noncentral *t*-distribution is a good compromise between speed and accuracy and hence, the default in all functions. The exact method based on Owen’s Q-function is time-consuming and therefore, not recommended in validating a custom method in a narrow grid of *n*~1~/*CV*-combinations. However, in designing a new study it is the method of choice.
Blinded sample size re-estimation (*α* 0.03505, *CV* 0.239, *n*~1~ 10, target power 0.90), 1 million simulations for the empiric type I error.
```
# method TIE seconds
# ls 0.049054 3.67
# shifted 0.046106 12.85
# nct 0.046319 18.24
# exact 0.046319 429.10
```
The crude large sample approximation (`pmethod = "ls"`) should only be used to compare with the published method.
<small>[TOC ↩](#power2stage)</small>
## Installation
You can install the released version of Power2Stage from [CRAN](https://CRAN.R-project.org) with …
```{r inst}
package <- "Power2Stage"
inst <- package %in% installed.packages()
if (length(package[!inst]) > 0) install.packages(package[!inst])
```
… and the development version from [GitHub](https://github.com/) with
```
# install.packages("devtools")
devtools::install_github("Detlew/Power2Stage")
```
Skips installation from a github remote if the [SHA-1](https://en.wikipedia.org/wiki/SHA-1) has not changed since last install. Use `force = TRUE` to force installation.
<small>[TOC ↩](#power2stage)</small>
## Session Information
Inspect this information for reproducibility. Of particular importance are the versions of R and the packages used to create this workflow. It is considered good practice to record this information with every analysis.\
Version `r packageVersion("Power2Stage")` built `r packageDate("Power2Stage", date.fields = "Built")` with R `r substr(packageDescription("Power2Stage", fields = "Built"), 3, 7)`.
```{r, sessioninfo}
options(width = 66)
sessionInfo()
```
<small>[TOC ↩](#power2stage)</small>