Package 'smartsizer'

Title: Power Analysis for a SMART Design
Description: A set of tools for determining the necessary sample size in order to identify the optimal dynamic treatment regime in a sequential, multiple assignment, randomized trial (SMART). Utilizes multiple comparisons with the best methodology to adjust for multiple comparisons. Designed for an arbitrary SMART design. Please see Artman (2018) <doi:10.1093/biostatistics/kxy064> for more details.
Authors: William Artman [aut, cre]
Maintainer: William Artman <[email protected]>
License: GPL-3
Version: 1.0.3
Built: 2025-03-13 05:17:27 UTC
Source: https://github.com/cran/smartsizer

Help Index


Compute the Power in a SMART

Description

Computes the power in an arbitrary SMART design with the goal of identifying optimal embedded dynamic treatment regime (EDTR). The power is the probability of excluding from the set of best EDTRs all EDTRs which are inferior to the best EDTR by min_Delta or more.

Usage

computePower(V, Delta, min_Delta, alpha = 0.05, sample_size)

Arguments

V

The covariance matrix of mean EDTR estimators.

Delta

The vector of effect sizes with a zero indicating the best EDTR.

min_Delta

The minimum desired detectable effect size.

alpha

The Type I error rate for not including the true best EDTR.

sample_size

The sample size.

Details

The true best EDTR is included in the set of best with probability at least 1-alpha. Multiple comparisons are adjusted for using the Multiple Comparison with the Best methodology.

Value

The power to exclude from the set of best EDTR all EDTR which are inferior to the best EDTR by min_Delta or more.

See Also

computeSampleSize

Examples

V <- rbind(c(1, 0.3, 0.3, 0.3),
             c(0.3, 1, 0.3, 0.3),
             c(0.3, 0.3, 1, 0.3),
             c(0.3, 0.3, 0.3, 1))

  #Compute power to exclude EDTRs inferior to the best by 0.3 or more
  #The first DTR is best and the other three are inferior by 0.2, 0.6, and 0.3
  #The best DTR is included with probability greater than or equal to 95%.
  computePower(V,
               Delta = c(0, 0.2, 0.6, 0.3),
               min_Delta = 0.3,
               sample_size = 200)

Compute the Power Over a Grid of Sample Size Values

Description

Computes the power over a grid of sample size values.

Usage

computePowerBySampleSize(V, Delta, min_Delta, alpha = 0.05, sample_size_grid)

Arguments

V

The covariance matrix of mean EDTR estimators.

Delta

The vector of effect sizes with a zero indicating the best EDTR.

min_Delta

The minimum desired detectable effect size.

alpha

The Type I error rate for not including the true best EDTR.

sample_size_grid

The vector of sample sizes

Details

It employs common random variables to reduce the variance. See computePower for more details.

Value

A vector of power for each sample size in the given grid.

See Also

computePower

Examples

V <- rbind(c(1, 0.3, 0.3, 0.3),
             c(0.3, 1, 0.3, 0.3),
             c(0.3, 0.3, 1, 0.3),
             c(0.3, 0.3, 0.3, 1))
  computePowerBySampleSize(V,
                           Delta = c(0, 0.2, 0.6, 0.3),
                           min_Delta = 0.3,
                           sample_size_grid = seq(50,300, 50))

Compute the Sample Size for a SMART.

Description

Computes the necessary sample size to enroll in an arbitrary SMART design for a specified power with the goal of determining optimal embedded dynamic treatment regime (EDTR). The power is the probability of excluding from the set of best EDTRs all EDTRs inferior to the best by min_Delta or more.

Usage

computeSampleSize(V, Delta, min_Delta, alpha = 0.05, desired_power)

Arguments

V

The covariance matrix of mean EDTR estimators.

Delta

The vector of effect sizes with the first zero indicating the best EDTR.

min_Delta

The minimum desired detectable effect size.

alpha

The Type I error rate for not including the true best EDTR.

desired_power

The desired power.

Details

The true best EDTR is included in the set of best with probability at least 1-alpha. Multiple comparisons are adjusted for using the Multiple Comparison with the Best methodology.

Value

The minimum sample size in order to achieve a power of desired_power to exclude EDTRs from the set of best which are inferior to the optimal EDTR by min_Delta or more.

See Also

computePower

Examples

V <- rbind(c(1, 0.3, 0.3, 0.3),
             c(0.3, 1, 0.3, 0.3),
             c(0.3, 0.3, 1, 0.3),
             c(0.3, 0.3, 0.3, 1))

  #Compute sample size to achieve power of 80% to exclude EDTRs inferior
  #to the best by 0.3 or more. The first DTR is best and the other
  #three are inferior by 0.2, 0.6, and 0.3
  #The best EDTR is included with probability greater than or equal to 95%.
  computeSampleSize(V,
                    Delta = c(0, 0.2, 0.6, 0.3),
                    min_Delta = 0.3,
                    alpha = 0.05,
                    desired_power = 0.8)

Plot Power by Sample Size

Description

Plots the power over a grid of sample sizes.

Usage

plotPowerByN(V, Delta, min_Delta, alpha = 0.05, sample_size_grid,
  color = "black")

Arguments

V

The covariance matrix of mean EDTR estimators.

Delta

The vector of effect sizes with a zero indicating the best EDTR.

min_Delta

The minimum desired detectable effect size.

alpha

The Type I error rate for not including the true best EDTR.

sample_size_grid

A vector of sample sizes.

color

The color of the graph.

Details

It employs common random variables to reduce the variance. See computePower for more details.


smartsizer: A package for Sizing SMART Designs

Description

The smartsizer package is designed to assist investigators with sizing sequential, multiple assignment, randomized trial (SMART) for determination of the optimal dynamic treatment regime (DTR). smartsizer includes functions which permit calculation of the minimum number of individuals to enroll in a SMART in order to be able to detect a specified effect size between the best and inferior embedded DTR, with a specified power. smartsizer is designed for an arbitrary SMART design.