snSMART

snSMART: An R Package for Small Sample, Sequential, Multiple Assignment, Randomized Trial Data Analysis - Published in JOSS (2024)

https://github.com/sidiwang/snsmart

Science Score: 95.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 4 DOI reference(s) in README and JOSS metadata
  • Academic publication links
    Links to: joss.theoj.org
  • Committers with academic emails
    4 of 14 committers (28.6%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
    Published in Journal of Open Source Software

Keywords

bayesian-analysis clinical-trials r rare-disease small-sample
Last synced: 7 months ago · JSON representation

Repository

small n sequential multiple assignment randomized trial (snSMART)

Basic Info
  • Host: GitHub
  • Owner: sidiwang
  • License: gpl-2.0
  • Language: R
  • Default Branch: main
  • Homepage:
  • Size: 1.32 MB
Statistics
  • Stars: 1
  • Watchers: 2
  • Forks: 2
  • Open Issues: 2
  • Releases: 1
Topics
bayesian-analysis clinical-trials r rare-disease small-sample
Created almost 5 years ago · Last pushed over 1 year ago
Metadata Files
Readme Contributing License Code of conduct

README.Rmd

---
output: github_document
---

# snSMART

![cran-badge example for snSMART package](http://www.r-pkg.org/badges/version/snSMART)
[![R-CMD-check](https://github.com/sidiwang/snSMART/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/sidiwang/snSMART/actions/workflows/R-CMD-check.yaml)
![RStudio CRAN downloads](http://cranlogs.r-pkg.org/badges/grand-total/snSMART)
![RStudio CRAN monthly downloads](http://cranlogs.r-pkg.org/badges/snSMART)
[![License: GPL v2](https://img.shields.io/badge/License-GPL_v2-blue.svg)](https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html)
[![Project Status: Active – The project has reached a stable, usable state and is being actively developed.](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/)
[![Codecov test coverage](https://codecov.io/gh/sidiwang/snSMART/branch/main/graph/badge.svg)](https://app.codecov.io/gh/sidiwang/snSMART?branch=main)
[![DOI](https://joss.theoj.org/papers/10.21105/joss.06971/status.svg)](https://doi.org/10.21105/joss.06971)



The aim of the **snSMART** R package is to consolidate data simulation, sample size calculation and analysis functions for several snSMART (small sample sequential, multiple assignment, randomized trial) designs under one library.

An snSMART is a multi-stage trial design where for a two-stage design, randomization  in  the  second  stage  depends  on  the  outcome  to  first  stage  treatment. snSMART  designs  require  that  the  same  outcome  is measured at the end of the first stage and at the end of the second stage. Additionally, the length of the first stage of the trial must be the same amount of time as the length for the second stage. snSMARTs are motivated by obtaining more information from a small sample of individuals with the primary goal to identify the superior first stage treatment or dosage level using both stages of data.  Data are shared across the two stages of the snSMART design to more precisely estimate the effect of the treatments given in the first stage.

## Installation

Before using this package, please install the [JAGS library](https://sourceforge.net/projects/mcmc-jags/) on your device.

You can install the snSMART package from CRAN:
```{r}
install.packages("snSMART", repos = "http://cran.us.r-project.org")
library(snSMART)
```
Or get the development version from GitHub:
```{r echo = TRUE, eval = FALSE}
# Install devtools first if you haven't done so
library(devtools)
# install snSMART
devtools::install_github("sidiwang/snSMART")
library(snSMART)
```


## snSMART designs and functions covered in this package

* snSMART with binary outcome (3 active treatments or placebo and 2 dose level, non-responders re-randomized)
  +   Bayesian Joint Stage Model (BJSM) analysis function - `BJSM_binary`
  +   Log Poisson Joint Stage Model (JSRM) analysis function - `JSRM_binary`
  +   sample size calculation function - `sample_size`
  +   Group Sequential snSMART BJSM analysis function - `group_seq`
* snSMART with mapping function (3 active treatments, re-randomization depends on continuous outcome at stage 1; continuous outcomes)
  +   BJSM analysis function - `BJSM_c`
  
## Example 
`BJSM_binary`:
We call the `BJSM_binary` function using data from an snSMART with 30 total individuals. We assumed a six beta model with the priors for $\pi_A, \pi_B$ and $\pi_C$ being $Beta(0.4, 1.6)$, the prior for $\beta_{0m}$ being $Beta(1.6, 0.4)$, and the prior for $\beta_{1m}$ being $Pareto(3, 1)$. The coverage probability for credible intervals is set to 0.95, and the expected response rate of DTR will also be calculated. 
```{r}
mydata <- data_binary
BJSM_result <- BJSM_binary(
  data = mydata, prior_dist = c("beta", "beta", "pareto"),
  pi_prior = c(0.4, 1.6, 0.4, 1.6, 0.4, 1.6), beta_prior = c(1.6, 0.4, 3, 1),
  n_MCMC_chain = 1, n.adapt = 1000, MCMC_SAMPLE = 20, ci = 0.95,
  six = TRUE, DTR = TRUE, verbose = FALSE
)
summary(BJSM_result)
```
`LPJSM_binary`:
Here, we call the LPJSM_binary mirroring our example for the BJSM_binary above.
```{r}
LPJSM_result <- LPJSM_binary(data = data_binary, six = TRUE, DTR = TRUE)
summary(LPJSM_result)
```
`sample_size`:
In this example, we call the function to request the sample size needed per arm with the following assumptions: the response rates for treatments A, B, and C are 0.7, 0.5 and 0.25, respectively; $\beta_1$ is assumed to be 1.4; $\beta_0$ is assumed to be 0.5; the coverage rate for the posterior difference of top two treatments is set to 0.9; the ‘power’ is set to 0.8; the prior sample size is 4 for treatment A, 2 for treatment B and 3 for treatment C; the prior means are 0.65 for treatment A, 0.55 for treatment B and 0.25 for treatment C
```{r}
sampleSize <- sample_size(
  pi = c(0.7, 0.5, 0.25), beta1 = 1.4, beta0 = 0.5,
  coverage = 0.9, power = 0.8, mu = c(0.65, 0.55, 0.25),
  n = c(4, 2, 3)
)
```
`group_seq`:
This function either outputs which treatment arm should be dropped if \code{interim = TRUE} or provides a full BJSM analysis based on the complete dataset if \code{interim = FALSE}. The dataset \code{groupseqDATA\_look1} and \code{groupseqDATA\_full} are provided in the \pkg{snSMART} package for illustration purpose. 
```{r}
result1 <- group_seq(
  data = groupseqDATA_look1, interim = TRUE, drop_threshold_pair = c(0.5, 0.4),
  prior_dist = c("beta", "beta", "pareto"), pi_prior = c(0.4, 1.6, 0.4, 1.6, 0.4, 1.6),
  beta_prior = c(1.6, 0.4, 3, 1), MCMC_SAMPLE = 6000, n.adapt = 1000, n_MCMC_chain = 1
)
```

```{r}
result2 <- group_seq(
  data = groupseqDATA_full, interim = FALSE, prior_dist = c("beta", "beta", "pareto"),
  pi_prior = c(0.4, 1.6, 0.4, 1.6, 0.4, 1.6), beta_prior = c(1.6, 0.4, 3, 1),
  MCMC_SAMPLE = 60000, BURN.IN = 10000, n_MCMC_chain = 1, ci = 0.95, DTR = TRUE
)
summary(result2)
```
`BJSM_c`:
Below, we call the function assuming the mean and standard deviation of the normal prior being 50 and 50 for all three treatments, and the standard deviation of the prior distribution of $\phi_3$ being 20. The number of MCMC chain is set to 1 with 1,000 adaptation iterations and 5,000 total iterations. 
```{r}
BJSM_result <- BJSM_c(
  data = trialDataMF, xi_prior.mean = c(50, 50, 50), xi_prior.sd = c(50, 50, 50),
  phi3_prior.sd = 20, n_MCMC_chain = 1, n.adapt = 1000, MCMC_SAMPLE = 5000, BURN.IN = 1000,
  ci = 0.95, n.digits = 5
)
summary(BJSM_result)
```
This R package will continue to be updated as more snSMART designs and methods are developed. We hope that this package translates snSMART design and methods into finding more effective treatments for rare disease.

## References

Chao, Y.C., Trachtman, H., Gipson, D.S., Spino, C., Braun, T.M. and Kidwell, K.M., 2020. Dynamic treatment regimens in small n, sequential, multiple assignment, randomized trials: An application in focal segmental glomerulosclerosis. Contemporary clinical trials, 92, p.105989.

Chao, Y.C., Braun, T.M., Tamura, R.N. and Kidwell, K.M., 2020. A Bayesian group sequential small n sequential multiple‐assignment randomized trial. Journal of the Royal Statistical Society: Series C (Applied Statistics), 69(3), pp.663-680.

Fang, F., Hochstedler, K.A., Tamura, R.N., Braun, T.M. and Kidwell, K.M., 2021. Bayesian methods to compare dose levels with placebo in a small n, sequential, multiple assignment, randomized trial. Statistics in Medicine, 40(4), pp.963-977.

Hartman, H., Tamura, R.N., Schipper, M.J. and Kidwell, K.M., 2021. Design and analysis considerations for utilizing a mapping function in a small sample, sequential, multiple assignment, randomized trials with continuous outcomes. Statistics in Medicine, 40(2), pp.312-326.

Wei, B., Braun, T.M., Tamura, R.N. and Kidwell, K., 2020. Sample size determination for Bayesian analysis of small n sequential, multiple assignment, randomized trials (snSMARTs) with three agents. Journal of Biopharmaceutical Statistics, 30(6), pp.1109-1120.

Wei, B., Braun, T.M., Tamura, R.N. and Kidwell, K.M., 2018. A Bayesian analysis of small n sequential multiple assignment randomized trials (snSMARTs). Statistics in medicine, 37(26), pp.3723-3732.

Owner

  • Login: sidiwang
  • Kind: user
  • Location: Ann Arbor
  • Company: University of Michigan

PhD Student in Biostatistics

JOSS Publication

snSMART: An R Package for Small Sample, Sequential, Multiple Assignment, Randomized Trial Data Analysis
Published
September 12, 2024
Volume 9, Issue 101, Page 6971
Authors
Sidi Wang ORCID
University of Michigan
Fang Fang ORCID
University of Michigan
Roy Tamura
University of South Florida
Thomas Braun ORCID
University of Michigan
Kelley M. Kidwell ORCID
University of Michigan
Editor
Øystein Sørensen ORCID
Tags
rare disease clinical trial snSMART Bayesian

GitHub Events

Total
  • Fork event: 1
Last Year
  • Fork event: 1

Committers

Last synced: 8 months ago

All Time
  • Total Commits: 196
  • Total Committers: 14
  • Avg Commits per committer: 14.0
  • Development Distribution Score (DDS): 0.49
Past Year
  • Commits: 30
  • Committers: 2
  • Avg Commits per committer: 15.0
  • Development Distribution Score (DDS): 0.067
Top Committers
Name Email Commits
Sidi Wang s****g@u****u 100
Sidi Wang s****g@S****l 65
Michael Kleinsasser m****a@u****u 6
Sidi Wang s****g@v****u 6
Michael Kleinsasser mk@M****l 4
Sidi Wang s****g@0****t 3
Øystein Sørensen o****n@h****m 2
Sidi Wang s****g@0****t 2
Michael Kleinsasser mk@M****e 2
Michael Kleinsasser mk@0****t 2
Sidi Wang s****g@v****u 1
Sidi Wang s****g@0****t 1
Sidi Wang s****g@0****t 1
Sidi Wang s****g@0****t 1

Issues and Pull Requests

Last synced: 7 months ago

All Time
  • Total issues: 2
  • Total pull requests: 36
  • Average time to close issues: N/A
  • Average time to close pull requests: about 1 hour
  • Total issue authors: 2
  • Total pull request authors: 3
  • Average comments per issue: 5.5
  • Average comments per pull request: 0.03
  • Merged pull requests: 30
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 2
  • Pull requests: 14
  • Average time to close issues: N/A
  • Average time to close pull requests: 25 minutes
  • Issue authors: 2
  • Pull request authors: 2
  • Average comments per issue: 5.5
  • Average comments per pull request: 0.07
  • Merged pull requests: 13
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • aghaynes (1)
  • ezraporter (1)
Pull Request Authors
  • sidiwang (44)
  • osorensen (4)
  • mkleinsa (3)
Top Labels
Issue Labels
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • cran 239 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 5
  • Total maintainers: 1
cran.r-project.org: snSMART

Small N Sequential Multiple Assignment Randomized Trial Methods

  • Versions: 5
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 239 Last month
Rankings
Forks count: 28.8%
Dependent packages count: 29.8%
Stargazers count: 35.2%
Dependent repos count: 35.5%
Average: 41.6%
Downloads: 78.5%
Maintainers (1)
Last synced: 7 months ago

Dependencies

DESCRIPTION cran
  • R >= 3.4.0 depends
  • EnvStats * imports
  • HDInterval * imports
  • bayestestR * imports
  • condMVNorm * imports
  • cubature * imports
  • geepack * imports
  • magrittr * imports
  • pracma * imports
  • rjags * imports
  • rmutil * imports
  • tidyr * imports
  • truncdist * imports
  • coda * suggests
.github/workflows/R-CMD-check.yaml actions
  • actions/checkout v3 composite
  • r-lib/actions/check-r-package v2 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/test-coverage.yaml actions
  • actions/checkout v4 composite
  • actions/upload-artifact v4 composite
  • codecov/codecov-action v4 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite