{"id":20690246,"url":"https://github.com/merck/gsdesign2","last_synced_at":"2025-08-21T15:32:19.172Z","repository":{"id":45135327,"uuid":"364276598","full_name":"Merck/gsDesign2","owner":"Merck","description":"Group Sequential Design Under Non-Proportional Hazards","archived":false,"fork":false,"pushed_at":"2025-08-14T15:04:04.000Z","size":89081,"stargazers_count":25,"open_issues_count":13,"forks_count":8,"subscribers_count":10,"default_branch":"main","last_synced_at":"2025-08-15T03:58:08.251Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://merck.github.io/gsDesign2/","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Merck.png","metadata":{"files":{"readme":"README.Rmd","changelog":"NEWS.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2021-05-04T14:06:13.000Z","updated_at":"2025-08-01T19:36:19.000Z","dependencies_parsed_at":"2025-04-17T17:01:01.353Z","dependency_job_id":"72c86aea-e3f3-4b19-a315-f34cf5febb23","html_url":"https://github.com/Merck/gsDesign2","commit_stats":null,"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"purl":"pkg:github/Merck/gsDesign2","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Merck%2FgsDesign2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Merck%2FgsDesign2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Merck%2FgsDesign2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Merck%2FgsDesign2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Merck","download_url":"https://codeload.github.com/Merck/gsDesign2/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Merck%2FgsDesign2/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271500361,"owners_count":24770375,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-21T02:00:08.990Z","response_time":74,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-16T23:12:23.434Z","updated_at":"2025-08-21T15:32:17.783Z","avatar_url":"https://github.com/Merck.png","language":"R","readme":"---\noutput: github_document\n# The following code customizes the Knit button behavior to remove\n# redundant CSS from the rendered README.md for proper display on GitHub.\n# You do not need it for HTML, PDF, or other output formats.\nknit: |\n  (function(inputFile, encoding) {\n    rmarkdown::render(input = inputFile, encoding = encoding)\n    output \u003c- paste0(basename(tools::file_path_sans_ext(inputFile)), \".md\")\n    output |\u003e\n      readLines() |\u003e\n      paste0(collapse = \"\\n\") |\u003e\n      gsub(\"\u003cstyle\u003e.*?\u003c/style\u003e\", replacement = \"\", x = _) |\u003e\n      gsub(\"\u003cdiv[^\u003e]*\u003e|\u003c/div\u003e\", replacement = \"\", x = _) |\u003e\n      writeLines(con = output)\n    invisible(output)\n  })\n---\n\n\u003c!-- README.md is generated from README.Rmd. Please edit that file --\u003e\n\n```{r, include = FALSE}\nknitr::opts_chunk$set(\n  collapse = FALSE,\n  comment = \"#\u003e\"\n)\n```\n\n# gsDesign2 \u003cimg src=\"man/figures/logo.png\" align=\"right\" width=\"120\" /\u003e\n\n\u003c!-- badges: start --\u003e\n[![R-CMD-check](https://github.com/Merck/gsDesign2/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/Merck/gsDesign2/actions/workflows/R-CMD-check.yaml)\n[![Codecov test coverage](https://codecov.io/gh/Merck/gsDesign2/branch/main/graph/badge.svg)](https://app.codecov.io/gh/Merck/gsDesign2?branch=main)\n[![CRAN status](https://www.r-pkg.org/badges/version/gsDesign2)](https://CRAN.R-project.org/package=gsDesign2)\n[![CRAN Downloads](https://cranlogs.r-pkg.org/badges/gsDesign2)](https://cran.r-project.org/package=gsDesign2)\n\u003c!-- badges: end --\u003e\n\n## Objective\n\nThe goal of gsDesign2 is to enable fixed or group sequential design\nunder non-proportional hazards. Piecewise constant enrollment, failure\nrates and dropout rates for a stratified population are available to\nenable highly flexible enrollment, time-to-event and time-to-dropout\nassumptions. Substantial flexibility on top of what is in the gsDesign\npackage is intended for selecting boundaries. Comments on usability and\nfeatures are encouraged as this is still a young package.\n\n## Installation\n\nInstall the released version of gsDesign2 from CRAN:\n\n```{r, eval=FALSE}\ninstall.packages(\"gsDesign2\")\n```\n\nOr install the development version from GitHub with:\n\n```{r, eval=FALSE}\nremotes::install_github(\"Merck/gsDesign2\")\n```\n\n## Use cases\n\n### Step 1: specifying enrollment and failure rates\n\nThis is a basic example which shows you how to solve a common problem.\nWe assume there is a 4 month delay in treatment effect. Specifically, we\nassume a hazard ratio of 1 for 4 months and 0.6 thereafter. For this\nexample we assume an exponential failure rate and low exponential\ndropout rate. The `enroll_rate` specification indicates an expected\nenrollment duration of 12 months with exponential inter-arrival times.\n\n```{r, message=FALSE, warning=FALSE}\nlibrary(gsDesign2)\n\n# Basic example\n\n# Constant enrollment over 12 months\n# Rate will be adjusted later by gsDesign2 NPH to get sample size\nenroll_rate \u003c- define_enroll_rate(duration = 12, rate = 1)\n\n# 12 month median exponential failure rate in control\n# 4 month delay in effect with HR=0.6 after\n# Low exponential dropout rate\nmedian_surv \u003c- 12\nfail_rate \u003c- define_fail_rate(\n  duration = c(4, Inf),\n  fail_rate = log(2) / median_surv,\n  hr = c(1, .6),\n  dropout_rate = .001\n)\n```\n\nThe resulting failure rate specification is the following table. As many\nrows and strata as needed can be specified to approximate whatever\npatterns you wish.\n\n```{r, eval = FALSE}\nfail_rate |\u003e gt::gt()\n```\n\n```{r, echo = FALSE, eval = getRversion() \u003e= \"4.1\"}\nfail_rate |\u003e\n  gt::gt() |\u003e\n  gt::as_raw_html(inline_css = FALSE)\n```\n\n### Step 2: derive a fixed design with no interim analyses\n\nComputing a fixed sample size design with 2.5% one-sided Type I error\nand 90% power. We specify a trial duration of 36 months with `analysis_time`.\nEnrollment duration is the sum of `enroll_rate$duration`.\nWe used `fixed_design()` since there is a single analysis:\n\n```{r}\nfd \u003c- fixed_design_ahr(\n  enroll_rate = enroll_rate,\n  fail_rate = fail_rate,\n  alpha = 0.025,\n  power = 0.9,\n  study_duration = 36,\n  ratio = 1 # Experimental/control randomization ratio\n)\n```\n\nThe input enrollment rates have now been scaled to achieve power:\n\n```{r, eval = FALSE}\nfd$enroll_rate |\u003e gt::gt()\n```\n\n```{r, echo = FALSE, eval = getRversion() \u003e= \"4.1\"}\nfd$enroll_rate |\u003e\n  gt::gt() |\u003e\n  gt::as_raw_html(inline_css = FALSE)\n```\n\nThe failure and dropout rates remain unchanged from what was input.\nThe summary is obtained below. The columns are:\n\n- `Design`: sample size derivation method.\n- `N`: sample size; generally you will round up to an even number.\n- `Event`: generally you will round up.\n- `Bound`: Z value for efficacy; this is the inverse normal from 1 - alpha.\n- `alpha`: 1-sided alpha level for testing.\n- `Power`: power corresponding to enrollment, failure rate, and\n  trial targeted events.\n\n```{r, eval = FALSE}\nfd |\u003e\n  summary() |\u003e\n  as_gt()\n```\n\n```{r, echo = FALSE, eval = getRversion() \u003e= \"4.1\"}\nfd |\u003e\n  summary() |\u003e\n  as_gt() |\u003e\n  gt::as_raw_html(inline_css = FALSE)\n```\n\n### Step 3: group sequential design\n\nWe provide a simple example for a group sequential design that\ndemonstrates a couple of features not available in the gsDesign package.\nThe first is specifying analysis times by calendar time rather\nthan information fraction. The second is not having an efficacy and\nfutility bound at each analysis. This is in addition to having methods\nfor non-proportional hazards as demonstrated in the fixed design above\nand again here.\n\nWe use an O'Brien-Fleming spending function to derive our efficacy\nbounds at 24 and 36 months. For futility, we simply require a nominally\nsignificant trend in the wrong direction ($p \u003c 0.1$) after 8 months, a\ntrend in favor of experimental treatment after 14 months ($Z \u003e 0$) and\nno bound later ($Z = -\\infty$). Thus, we have two efficacy analyses and\ntwo separate, earlier futility analysis. Power is set to 80% due to the\nsomewhat aggressive futility bounds that are used for safety (analysis 1\nhalf way through enrollment) and proof of concept (analysis 2). Such\naggressive futility bounds may be desirable when a previous proof of\nconcept for experimental treatment has not been established;\nessentially, this becomes a Phase II/III design with an interim\nevaluation of appropriate efficacy trends before completing the trial.\n\n```{r}\ngsd \u003c- gs_design_ahr(\n  enroll_rate = enroll_rate,\n  fail_rate = fail_rate,\n  ratio = 1,\n  alpha = 0.025,\n  beta = 0.2, # 80% power; enables aggressive futility bound specified\n  analysis_time = c(8, 14, 24, 36),\n  binding = FALSE, # Non-binding futility bound\n  upper = gs_spending_bound, # Use spending bound for efficacy; total_spend is normally alpha\n  upar = list(sf = gsDesign::sfLDOF, total_spend = 0.025),\n  test_upper = c(FALSE, FALSE, TRUE, TRUE), # Only test efficacy after 1st analysis\n  lower = gs_b, # Fixed Z-values will be provided for futility bound\n  lpar = c(qnorm(0.1), 0, -Inf, -Inf)\n)\n```\n\nNow we summarize the derived design. The summary table is further described\nin the vignette [summarize group sequential designs in gt\ntables](https://merck.github.io/gsDesign2/articles/story-summarize-designs.html).\nNote that the design trend in favor of experimental treatment\nis very minor at 8 months due to the delayed effect assumption used\n(see AHR at analysis 1 in table). The design trend at 16 months is somewhat\nmore favorable when we are looking for HR \u003c 1 (favoring experimental\ntreatment) for a proof of concept. Actual bounds and timing selected for\na trial are situation dependent, but we hope the suggestions here are\nprovocative for what might be considered.\n\n```{r, eval = FALSE}\ngsd |\u003e\n  summary() |\u003e\n  as_gt()\n```\n\n```{r, echo = FALSE, eval = getRversion() \u003e= \"4.1\"}\ngsd |\u003e\n  summary() |\u003e\n  as_gt() |\u003e\n  gt::as_raw_html(inline_css = FALSE)\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmerck%2Fgsdesign2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmerck%2Fgsdesign2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmerck%2Fgsdesign2/lists"}