Package 'SMARTbayesR'

Title: Bayesian Set of Best Dynamic Treatment Regimes and Sample Size in SMARTs for Binary Outcomes
Description: Permits determination of a set of optimal dynamic treatment regimes and sample size for a SMART design in the Bayesian setting with binary outcomes. Please see Artman (2020) <arXiv:2008.02341>.
Authors: William Artman [aut, cre]
Maintainer: William Artman <[email protected]>
License: GPL-3
Version: 2.0.0
Built: 2024-11-21 06:08:42 UTC
Source: https://github.com/cran/SMARTbayesR

Help Index


Log-Odds Ratios for Embedded Dynamic Treatment Regimes

Description

Computes the embedded dynamic treatment regime specific log-odds ratios.

Usage

LogOR(
  response_prob = c(0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8),
  stage_one_trt_one_response_prob = 0.6,
  stage_one_trt_two_response_prob = 0.3,
  stage_one_trt_three_response_prob = 0.4,
  design = "general"
)

Arguments

response_prob

the probability of response for each of embedded treatment sequences. In the case of the design 1 SMART, there are 6, for the general design there are 8, and for Design-3 there are 9 embedded treatment sequences.

stage_one_trt_one_response_prob

the probability of response to stage-1 treatment given stage-1 treatment one.

stage_one_trt_two_response_prob

the probability of response to stage-1 treatment given stage-1 treatment two.

stage_one_trt_three_response_prob

the probability of response to stage-1 treatment given stage-1 treatment three (for design-3 only)

design

which SMART design: design-1 (ENGAGE-type), general, or design-3.

Value

The embedded dynamic treatment regime specific log-OR.


Log Risk Ratios for Embedded Dynamic Treatment Regimes

Description

Computes the embedded dynamic treatment regime specific log risk-ratios.

Usage

LogRR(
  response_prob = c(0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8),
  stage_one_trt_one_response_prob = 0.6,
  stage_one_trt_two_response_prob = 0.3,
  stage_one_trt_three_response_prob = 0.4,
  design = "general"
)

Arguments

response_prob

the probability of response for each of the embedded treatment sequences. In the case of the design 1 SMART there are 6, for the general design there are 8, and for design-3 there are 9.

stage_one_trt_one_response_prob

the probability of response to stage-1 treatment given stage-1 treatment one.

stage_one_trt_two_response_prob

the probability of response to stage-1 treatment given stage-1 treatment two.

stage_one_trt_three_response_prob

the probability of response to stage-1 treatment given stage-1 treatment three (for design-3 only)

design

which SMART design: design-1 (ENGAGE-type), general, or design-3

Value

The embedded dynamic treatment regime specific log-Risk Ratios.


Simultaneous Upper Credible Intervals

Description

Compute simultaneous upper credible intervals from draws of embedded dynamic treatment regime probabilities given by the function argument “thetadraws”.

Usage

MCBUpperLimits(thetadraws, alpha = 0.05, design = "design-1", type = "log-OR")

Arguments

thetadraws

draws of the embedded dynamic treatment regimes.

alpha

the probability of excluding the true best EDTR from the set of best.

design

specifies to which SMART design to apply function: either design-1, general, or design-3.

type

summary statistic: log-OR, log-RR, or RD

Value

Upper 1-alpha level simultaneous credible interval limits for the embedded dynamic treatment regimes.

Examples

dat <- SimDesign1(sample_size=250,
                  response_prob = c(0.5,0.9,0.3,0.7,0.5,0.8),
                  stage_one_trt_one_response_prob = 0.7,
                  stage_one_trt_two_response_prob = 0.4)

x <- PosteriorTrtSeqProb(niter = 1000, dat, design = "design-1")

thetadraws <- PosteriorEDTRProbs(x, design = "design-1")

MCBUpperLimits(thetadraws,
               alpha = 0.05,
               design = "design-1",
               type = "log-OR")

Convert Treatment Sequence Draws into Embedded Dynamic Treatment Regime Draws

Description

Apply Robins' G-computation formula to compute the embedded dynamic treatment regime draws from as a weighted average of treatment sequence and stage-1 response probability draws.

If design is "design-1", then compute for Design 1 SMART with 6 embedded treatment sequences and 4 embedded dynamic treatment regimes.

If design is "general", then compute for General SMART with 8 embedded treatment sequences and 8 embedded dynamic treatment regimes.

If design is "design-3", then compute for Design 3 SMART with 9 embedded treatment sequences and 6 embedded dynamic treatment regimes.

Usage

PosteriorEDTRProbs(x, design = "design-1")

Arguments

x

A data frame consisting of draws from the posterior of the end of study response probabilities of each treatment sequence and of stage-1 response probabilities for each stage-1 treatment

design

Which SMART design to compute the posterior draws for: "design-1" or "general" or "design-3".

Details

For the General SMART design, x should have columns p_1, p_2, p_3, p_4, p_5, p_6, p_7, p_8, s1, and s2.

For the Design-1 SMART, x should have columns p_1, p_2, p_3, p_4, p_5, p_6, s1, and s2.

For the design-3 SMART, x should have columns

p_1, p_2, p_3, p_4, p_5, p_6, p_7, p_8, p_9 s1, s2, and s3

These are the posterior draws of the response probabilities for each treatment sequence and stage-1 response probability draws.

s1 contains the draws of the stage-1 response probability for the first treatment, s2 is analogous for the second treatment and s3 for the third treatment.

Value

Matrix of EDTR specific posterior response probability draws at the end of the study There will be 4 columns for design-1, 8 columns for design general, and 6 columns for design-3 each corresponding to an EDTR. The number of rows will be the same as that of x.

Examples

dat <- SimDesign1(sample_size=250,
                  response_prob = c(0.5,0.9,0.3,0.7,0.5,0.8),
                  stage_one_trt_one_response_prob = 0.7,
                  stage_one_trt_two_response_prob = 0.4)

x <- PosteriorTrtSeqProb(niter = 1000, dat, design = "design-1")

PosteriorEDTRProbs(x, design = "design-1")

Treatment Sequence Response Probabilities from Dataset

Description

Draws from the posterior of the treatment sequence response probabilities.

Usage

PosteriorTrtSeqProb(niter, dat, design = "design-1")

Arguments

niter

the number of posterior draws.

dat

a data frame (see Details).

design

an indicator of which SMART design, design-1, general, or design-3.

Details

dat should contain the following columns:

y, the end of study binary response indicator

a1, the stage-1 treatment assignment indicator

s, the end of stage-1 binary response indicator

Additionally, for design-1 and design-3 it should contain a2, the stage-2 treatment assignment indicator

For the general design, it should contain

a2r, stage-2 treatment assignment for responders to stage-1 treatment.

a2nr, stage-2 treatment assignment for non-responders to stage-1 treatment.

Value

Posterior draws of the probability of response at the end of the study for each embedded treatment sequence and the posterior draws of the probability of response at the end of stage-1 for each stage-1 treatment.

Examples

dat <- SimDesign1(sample_size=250,
                              response_prob = c(0.5,0.9,0.3,0.7,0.5,0.8),
                              stage_one_trt_one_response_prob = 0.7,
                              stage_one_trt_two_response_prob = 0.4)

PosteriorTrtSeqProb(niter = 1000, dat, design = "design-1")

Power Calculation for a SMART with a Binary Outcome

Description

This function computes the power for a sequential multiple assignment randomized trial (SMART) of one of three designs: "design-1" or "general" or "design-3".

Usage

PowerBayesian(
  design = "design-1",
  sample_size = 100,
  response_prob = c(0.5, 0.9, 0.3, 0.7, 0.5, 0.8),
  stage_one_trt_one_response_prob = 0.7,
  stage_one_trt_two_response_prob = 0.5,
  stage_one_trt_three_response_prob = 0.4,
  type = "log-OR",
  threshold,
  alpha = 0.05
)

Arguments

design

specifies for which SMART design to calculate the power: design-1, general, or design-3.

sample_size

the total SMART study sample size.

response_prob

a vector of probabilities of response for each of embedded treatment sequences. In the case of design 1, there are 6, for general design there are 8, and for design-3 there are 9

stage_one_trt_one_response_prob

the probability of response to stage-1 treatment for first stage-1 treatment.

stage_one_trt_two_response_prob

the probability of response to stage-1 treatment for second stage-1 treatment.

stage_one_trt_three_response_prob

the probability of response to stage-1 treatment for third stage-1 treatment (for design-3 only).

type

specifies log-OR, RD or log-RR.

threshold

minimum detectable difference between each EDTR and the best

alpha

probability of excluding optimal embedded dynamic treatment regime

Value

The power to exclude embedded dynamic treatment regimes bigger than threshold from the set of best.

Examples

PowerBayesian(
  design = "design-1",
  sample_size = 100,
  response_prob = c(0.5, 0.9, 0.3, 0.7, 0.5, 0.8),
  stage_one_trt_one_response_prob = 0.7,
  stage_one_trt_two_response_prob = 0.5,
  type="log-OR",
  threshold=0.2
)

PowerBayesian(
  design = "general",
  sample_size = 250,
  response_prob = c(0.5, 0.9, 0.7, 0.2, 0.3, 0.8, 0.4, 0.7),
  stage_one_trt_one_response_prob = 0.7,
  stage_one_trt_two_response_prob = 0.5,
  type="log-OR",
  threshold=0.2
)

Risk Differences for Embedded Dynamic Treatment Regimes

Description

Computes the embedded dynamic treatment regime specific risk differences with the best.

Usage

RD(
  response_prob = c(0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8),
  stage_one_trt_one_response_prob = 0.6,
  stage_one_trt_two_response_prob = 0.3,
  stage_one_trt_three_response_prob = 0.4,
  design = "general"
)

Arguments

response_prob

the probability of response for each of embedded treatment sequences. In the case of the design 1 SMART, there are 6, for the general design there are 8, and for design-3, there are 9.

stage_one_trt_one_response_prob

the probability of response to stage-1 treatment given stage-1 treatment one.

stage_one_trt_two_response_prob

the probability of response to stage-1 treatment given stage-1 treatment two.

stage_one_trt_three_response_prob

the probability of response to stage-1 treatment given stage-1 treatment three (for design-3 only)

design

which SMART design: design-1 or general.

Value

The embedded dynamic treatment regime specific risk differences.


Simulate a SMART with Design 1

Description

This function simulates a SMART with Design 1.

Usage

SimDesign1(
  sample_size = 250,
  response_prob = c(0.5, 0.5, 0.5, 0.8, 0.7, 0.5),
  stage_one_trt_one_response_prob = 0.7,
  stage_one_trt_two_response_prob = 0.4
)

Arguments

sample_size

the total sample size

response_prob

a vector of probabilities of response for each of the 6 embedded treatment sequences.

stage_one_trt_one_response_prob

the probability of response to first stage-1 treatment.

stage_one_trt_two_response_prob

the probability of response to second stage-1 treatment.

Value

a data frame with treatment response indicators for each stage of treatment, a1 and a2, end of stage-1 response indicator s, and final outcome y.

Examples

dat <- SimDesign1(sample_size=250,
                             response_prob = c(0.5,0.9,0.3,0.7,0.5,0.8),
                             stage_one_trt_one_response_prob = 0.7,
                             stage_one_trt_two_response_prob = 0.4)

SMARTbayesR: A package for Bayesian computation of optimal embedded dynamic treatment regimes and sample size determination with binary outcomes

Description

The SMARTbayesR package allows computation of a set of optimal embedded dynamic treatment regimes for a SMART. Furthermore, it allows power to be calculated for sample size determination.

SMARTbayesR functions

SimDesign1 simulates a design-1 type SMART

PosteriorTrtSeqProb draws from the posterior of the probabilities of response for each embedded treatment sequence and stage-1 response probabilities.

PosteriorEDTRProbs converts treatment sequence end of study response probabilities, stage-1 response probabilities into end of study embedded dynamic treatment regime response probabilities.

MCBUpperLimits calculates simultaneous credible intervals which determines the set of optimal dynamic treatment regimes

LogOR computes the log-OR between each embedded dynamic treatment regime and the best.

LogRR computes the log-RR between each embedded dynamic treatment regime and the best.

RD computes the risk difference between each embedded dynamic treatment regime and the best.

PowerBayesian computes the power in a SMART to exclude embedded dynamic treatment regimes inferior to the best by a specified amount.

Please see Artman (2020) <arXiv:2008.02341> for details about the methodology.