At different stages of drug development, there are questions about
how likely a study will be successful given previously collected data
within the trial itself or data from other earlier trials. For example
given Ph2a (PoC, proof of concept) and Ph2b (DRF, dose range finding)
studies, how likely a new Ph3 study would be successful is of great
interest. Another example, at an interim analysis (IA) of a PoC study,
one would also be interested to understand the probability of success at
the end of the study given the partial data observed.
** pos1S()** and

`pos2S()`

`pos2S()`

The primary endpoint for this study is log transformed facial lesion count, assumed to be normally distributed. Decrease in the lesion count upon treatment is considered improvement in the patients. Below is the summary statistics of this primary endpoint by group at the interim.

```
<- data.frame(n=c(12, 14),
ia median_count=c(20.5, 21),
mean_count=c(23.3, 27),
mean_log=c(2.96, 3.03),
sd_log=c(0.67, 0.774),
row.names=c("active", "placebo")) %>%
transform(se_log=round(sd_log/sqrt(n), 3))
<- with(ia, sqrt(sum(sd_log^2*(n-1))/(sum(n)-2)))
sd_log_pooled kable(ia)
```

n | median_count | mean_count | mean_log | sd_log | se_log | |
---|---|---|---|---|---|---|

active | 12 | 20.5 | 23.3 | 2.96 | 0.670 | 0.193 |

placebo | 14 | 21.0 | 27.0 | 3.03 | 0.774 | 0.207 |

The predefined dual PoC criteria is as follows,

```
<- 21 # planned total n per arm
n <- decision2S(c(0.9, 0.5), c(0,-0.357), lower.tail = TRUE)
rules print(rules)
```

```
## 2 sample decision function
## Conditions for acceptance:
## P(theta1 - theta2 <= 0) > 0.9
## P(theta1 - theta2 <= -0.357) > 0.5
## Link: identity
```

The interim data were evaluated against the PoC criteria with weakly informative priors for both active and placebo groups. The criteria were not met, although it seemed to show some benefit of the active treatment over placebo numerically. The variability of this endpoint is higher than what was assumed for study sample size calculation.

```
<- priorT <- mixnorm(c(1, log(20), 1), sigma = 0.47, param = 'mn')
priorP ## posterior at IA data
<- postmix(priorT, m=ia["active","mean_log"], se=ia["active","se_log"])
postT_interim <- postmix(priorP, m=ia["placebo","mean_log"], se=ia["placebo","se_log"])
postP_interim pmixdiff(postT_interim, postP_interim, 0)
```

`## [1] 0.5900663`

`pmixdiff(postT_interim, postP_interim,-0.357)`

`## [1] 0.12637`

The probability of success at the final analysis, i.e. the
probability of meeting PoC criteria at trial completion given observed
interim data, was computed using function
** pos2S()**. One could assume that the new
data after the interim would be from the same distribution as the
interim data. If the \(\sigma_{1}\) and
\(\sigma_{2}\) in

`pos2S()`

```
<- pos2S(
pos_final
postT_interim,
postP_interim,- ia["active","n"],
n - ia["placebo","n"],
n
rules,sigma1 = sd_log_pooled,
sigma2 = sd_log_pooled
)
```

The function constructed by ** pos2S()** can
produce the predictive probability given any defined distribution for
the two groups. For example, if the interim posterior distributions are
used, the calculated probability is small, suggesting a low chance of
success at the final analysis given observed IA data.

`pos_final(postT_interim, postP_interim)`

`## [1] 0.02413245`

One can also use ** oc2S()** to compute
conditional power for any given treatment effect.

```
<- oc2S(
ia_oc
postT_interim,
postP_interim,- ia["active","n"],
n - ia["placebo","n"],
n
rules,sigma1 = sd_log_pooled,
sigma2 = sd_log_pooled
)
<- seq(0, 0.9, 0.01) #pct diff from pbo
delta <- ia["placebo","mean_log"]
pbomean <- log(exp(pbomean) * (1 - delta)) #active
y1 <- log(exp(pbomean) * (1 - 0 * delta)) #placebo
y2
<-
out data.frame(
diff_pct = delta,
diff = round(y1 - y2, 2),
y_act = y1,
y_pbo = y2,
cp = ia_oc(y1, y2)
)
ggplot(data = out, aes(x = diff_pct, y = cp)) + geom_line() +
scale_x_continuous(labels = scales::percent) +
labs(y = 'Conditional power',
x = 'True percentage difference from placebo in lesion count',
title = 'Conditional power at interim for success at final analysis')
```

```
## R version 4.1.0 (2021-05-18)
## Platform: aarch64-apple-darwin20 (64-bit)
## Running under: macOS 13.5
##
## Matrix products: default
## BLAS: /Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/lib/libRblas.dylib
## LAPACK: /Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/lib/libRlapack.dylib
##
## locale:
## [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
##
## attached base packages:
## [1] stats graphics grDevices utils datasets methods base
##
## other attached packages:
## [1] scales_1.2.1 purrr_0.3.5 bayesplot_1.10.0 tidyr_1.2.1
## [5] dplyr_1.0.10 ggplot2_3.4.2 knitr_1.40 RBesT_1.7-2
##
## loaded via a namespace (and not attached):
## [1] Rcpp_1.0.9 mvtnorm_1.1-3 prettyunits_1.1.1
## [4] ps_1.7.1 assertthat_0.2.1 digest_0.6.30
## [7] utf8_1.2.2 plyr_1.8.7 R6_2.5.1
## [10] backports_1.4.1 stats4_4.1.0 evaluate_0.17
## [13] highr_0.9 pillar_1.8.1 rlang_1.1.1
## [16] callr_3.7.3 jquerylib_0.1.4 checkmate_2.1.0
## [19] rmarkdown_2.20 labeling_0.4.2 textshaping_0.3.6
## [22] stringr_1.4.1 loo_2.5.1 munsell_0.5.0
## [25] compiler_4.1.0 xfun_0.37 rstan_2.21.7
## [28] pkgconfig_2.0.3 systemfonts_1.0.4 pkgbuild_1.3.1
## [31] rstantools_2.3.1 htmltools_0.5.3 tidyselect_1.2.0
## [34] tensorA_0.36.2 tibble_3.1.8 gridExtra_2.3
## [37] codetools_0.2-18 matrixStats_0.62.0 fansi_1.0.3
## [40] crayon_1.5.2 withr_2.5.0 distributional_0.3.2
## [43] grid_4.1.0 jsonlite_1.8.3 gtable_0.3.1
## [46] lifecycle_1.0.3 DBI_1.1.3 posterior_1.4.1
## [49] magrittr_2.0.3 StanHeaders_2.21.0-7 RcppParallel_5.1.5
## [52] cli_3.4.1 stringi_1.7.8 cachem_1.0.6
## [55] reshape2_1.4.4 farver_2.1.1 bslib_0.4.0
## [58] ellipsis_0.3.2 ragg_1.2.1 generics_0.1.3
## [61] vctrs_0.5.0 Formula_1.2-4 tools_4.1.0
## [64] glue_1.6.2 processx_3.7.0 abind_1.4-5
## [67] parallel_4.1.0 fastmap_1.1.0 yaml_2.3.6
## [70] inline_0.3.19 colorspace_2.0-3 sass_0.4.2
```