`library(SMARTbayesR)`

This R package provides functions for power analysis and the construction of the set of best using Bayesian multiple comparison with the best methodology.

This methodology is applicable to sequential, multiple assignment, randomized trials with binary outcomes.

We extend frequentist methods to the Bayesian setting. In particular, one may determine what sample size to enroll in order to achieve a specified power, where power is the probability of excluding inferior embedded dynamic treatment regimes from the set of best.

The set of best consists of embedded dynamic treatment regimes which are not significantly inferior to the optimal or best embedded dynamic treatment regime (Artman et al. 2020).

In this vignette, we outline how the functions may be used together to achieve these goals.

First, run \(\texttt{SimDesign1}\) to simulate a design-1 SMART.

Then, apply \(\texttt{PosteriorTrtSeqProb}\) to sample from the posterior of the probabilities of response at each stage.

To obtain draws from the probabilities of response for each of the embedded dynamic treatment regimes (EDTRs), run \(\texttt{PosteriorEDTRProbs}\).

In order to construct the set of best (or equivalently, upper credible interval limits), run \(\texttt{MCBUpperLimits}\).

```
set.seed(23856)
<- SimDesign1(sample_size = 250,
dat response_prob = c(0.2,0.3,0.4,0.5,0.6,0.7),
stage_one_trt_one_response_prob = 0.7,
stage_one_trt_two_response_prob = 0.4)
```

```
set.seed(39864)
<- PosteriorTrtSeqProb(niter = 10000,
posterior_trt_seq_draws
dat,design = "design-1")
```

Convert draws from each treatment sequence to draws from each embedded DTR.

`<- PosteriorEDTRProbs(posterior_trt_seq_draws) posterior_EDTR_draws `

```
MCBUpperLimits(thetadraws=posterior_EDTR_draws,
alpha=0.05,
design="design-1")
#> [1] -0.7952722 -0.9520819 0.4614265 0.0000000
```

Note that EDTRs 1 and 2 are statistically significantly inferior to EDTR 4 whereas EDTR 3 is not.

To see what the log-odds ratios are, run \(\texttt{LogOR}\). Lastly, to compute the power to exclude inferior embedded dynamic treatment regimes (EDTRs) from the set of best (or equivalently, for their upper credible interval to exclude 0), run \(\texttt{PowerBayesian}\).

Compute log-OR of a success.

```
LogOR(response_prob = c(0.3,0.3,0.3,0.8,0.6,0.7),
stage_one_trt_one_response_prob = 0.6,
stage_one_trt_two_response_prob = 0.4,
design = "design-1")
#> EDTR 1 EDTR 2 EDTR 3 EDTR 4
#> 1: -1.893266 -1.893266 -0.2921968 0
```

Compute power to exclude embedded dynamic treatment regimes 1 and 2. The choice to exclude these embedded dynamic treatment regimes may be based off the values of the log-OR between each EDTR and the best.

```
set.seed(2364)
PowerBayesian("design-1",
sample_size = 100,
response_prob = c(0.2,0.3,0.4,0.5,0.6,0.7),
stage_one_trt_one_response_prob = 0.6,
stage_one_trt_two_response_prob = 0.4,
rejection_indices = c(1,2))
#> [1] 0.759
```

Artman, W. J., Ertefaie, A., Lynch, K. G., & McKay, J. R. (2020). Bayesian Set of Best Dynamic Treatment Regimes and Sample Size Determination for SMARTs with Binary Outcomes. arXiv preprint arXiv:2008.02341.