Package: gsDesignNB 0.3.2

gsDesignNB: Sample Size and Simulation for Negative Binomial Outcomes

Provides tools for planning and simulating recurrent event trials with overdispersed count endpoints analyzed using negative binomial (or Poisson) rate models. Implements sample size and power calculations for fixed designs with variable accrual, dropout, maximum follow-up, and event gaps, including methods of Zhu and Lakkis (2014) <doi:10.1002/sim.5947> and Friede and Schmidli (2010) <doi:10.3414/ME09-02-0060> as well as extensions for score-test sizing and gaps between events. Supports group sequential monitoring by building on the 'gsDesign' package. Includes recurrent-event simulation utilities (including seasonal rates), interim data truncation, Wald and score-test inference for rate ratios, and blinded or unblinded information estimation and sample size re-estimation.

Authors:Keaven Anderson [aut, cre], Hongtao Zhang [aut], Andrea Maes [aut], Nan Xiao [ctb], Merck & Co., Inc., Rahway, NJ, USA and its affiliates [cph]

gsDesignNB_0.3.2.tar.gz
gsDesignNB_0.3.2.zip(r-4.7)gsDesignNB_0.3.2.zip(r-4.6)gsDesignNB_0.3.2.zip(r-4.5)
gsDesignNB_0.3.2.tgz(r-4.6-any)gsDesignNB_0.3.2.tgz(r-4.5-any)
gsDesignNB_0.3.2.tar.gz(r-4.7-any)gsDesignNB_0.3.2.tar.gz(r-4.6-any)
gsDesignNB_0.3.2.tgz(r-4.6-emscripten)
manual.pdf |manual.html
DESCRIPTION |NEWS
card.svg |card.png
gsDesignNB/json (API)

# Install 'gsDesignNB' in R:
install.packages('gsDesignNB', repos = c('https://keaven.r-universe.dev', 'https://cloud.r-project.org'))

Bug tracker:https://github.com/keaven/gsdesignnb/issues

Pkgdown/docs site:https://keaven.github.io

On CRAN:

Conda:

6.68 score 1 stars 19 scripts 231 downloads 51 exports 83 dependencies

Last updated from:6e99e376b3. Checks:9 OK. Indexed: yes.

TargetResultTimeFilesSyslog
linux-devel-x86_64OK325
source / vignettesOK558
linux-release-x86_64OK359
macos-release-arm64OK217
macos-oldrel-arm64OK225
windows-develOK290
windows-releaseOK291
windows-oldrelOK281
wasm-releaseOK183

Exports:blinded_ssrcalculate_blinded_infocheck_gs_boundcompute_info_at_timecut_completerscut_data_by_datecut_date_for_completersestimate_nb_momfit_nb_glmmget_analysis_dateget_cut_dategsBoundSummarygsDesigngsNBCalendarimpute_nbimpute_nb_compositeimpute_nb_marimpute_nb_mnar_refmutze_testnb_simnb_sim_seasonalpreview_pkgdown_siterun_ssr_shinysample_size_nbinomsfBetaDistsfCauchysfExponentialsfExtremeValuesfExtremeValue2sfGappedsfHSDsfLDOFsfLDPococksfLinearsfLogisticsfNormalsfPointssfPowersfStepsfTDistsfTrimmedsfTruncatedsfXG1sfXG2sfXG3sim_gs_nbinomsim_ssr_nbinomsummarize_gs_simsummarize_ssr_simtoIntegerunblinded_ssr

Dependencies:base64encbigDbitopsbslibcachemclicodetoolscommonmarkcpp11curldata.tabledigestdoFuturedplyrevaluatefarverfastmapfontawesomeforeachfsfuturefuture.applygenericsggplot2globalsgluegsDesigngtgtablehighrhtmltoolshtmlwidgetsisobanditeratorsjquerylibjsonlitejuicyjuiceknitrlabelinglatticelifecyclelistenvlitedownmagrittrmarkdownMASSMatrixmemoisemimemvtnormparallellypillarpkgconfigpurrrr2rtfR6rappdirsRColorBrewerRcppreactablereactRrlangrmarkdownS7sassscalessimtrialstringistringrsurvivaltibbletidyrtidyselecttinytexutf8V8vctrsviridisLitewithrxfunxml2xtableyaml

Using the gsDesignNB AI skill
Purpose | Example task | Time-scale setup | Wald versus score sizing | Calendar-time group sequential design | Simulate, cut, and test a small data set | Production workflow reminder | What this skill is and is not

Last update: 2026-07-01
Started: 2026-05-01

Diagnosing Blinded Information Calculation Issues
Overview | Dataset 1: Near-Zero Blinded Information | Event Counts Summary | Event Distribution | Event Rates by Patient | Violin Plot of Event Rates | What Happened with the Information Calculations | Root Cause Analysis | Method of Moments Comparison | Dataset 2: Extreme High Blinded Information | Why the Mutze Test Falls Back to Poisson | Summary of Issues | Recommendations

Last update: 2026-05-01
Started: 2026-01-14

Group sequential design and simulation
Trial design parameters | Sample size calculation | Group sequential design | Simulation study | Load simulation results | Simulation results summary | Summary of verification results | Overall operating characteristics | Power comparison by analysis | Visualization of Z-statistics | Notes

Last update: 2026-05-01
Started: 2025-12-13

Sample size calculation for negative binomial outcomes
Notation | Methodology | Negative binomial distribution | Gamma-Poisson mixture motivation | Graphical illustration | Sample size formula | Relationship between Zhu-Lakkis, Friede-Schmidli, and Mutze et al. | Non-inferiority and super-superiority | Average exposure | Setup | Calendar exposure without dropout | Calendar exposure with dropout | Maximum follow-up | Weighted average across segments | Group-specific parameters | Variance inflation for variable follow-up ($Q$ factor) | Event gaps | Simulation verification of average exposure | Statistical information | Per-subject Fisher information | Total information | Information in practice: blinded and unblinded estimation | Connection to sample size | Examples | Basic calculation [@zhu2014sample] | Piecewise constant accrual | Accrual with dropout and max follow-up | Group-specific dropout rates | Calculating power for fixed design | Unequal allocation | Example with event gap | References

Last update: 2026-05-01
Started: 2025-12-13

Score vs Wald tests and sample-size recommendations
Introduction | Load pre-computed results | Scenario grid | Type I error comparison | Power comparison | Z-score density comparison (null simulations) | Fallback method frequency | Summary

Last update: 2026-05-01
Started: 2026-05-01

Simulating recurrent events
Simulation setup | Defining input parameters | Running the simulation | Analyzing the data | Inspect first ten records | Plotting events | Cutting data by analysis date | Missing data assumptions and imputation | Wald test [@mutze2019group] | Finding analysis date for target events | Generating and verifying negative binomial data | Simulation with dispersion | Verifying the dispersion parameter | Visualizing the distribution | References

Last update: 2026-05-01
Started: 2025-12-13

SSR simulation study
Introduction | Planned trial design | Fixed design | Group sequential design | Group sequential sample size under each nuisance scenario | Expected information fraction at planned time of each interim | Scenario grid | Simulation engine | Running simulations | Results | Starting sample-size sensitivity | Power by rate ratio and SSR strategy | Power by nuisance scenario | Adapted sample size distribution | Expected sample size at study stop | Calendar and information at each analysis | Discussion | Key findings | Information-based interim timing | Futility at low information | Blinded information fallback | Computational considerations | References

Last update: 2026-05-01
Started: 2026-02-24

Verification of sample size calculation via simulation
Introduction | Simulation design | Parameters | Theoretical calculation | Simulation results | Power comparison | Summary of verification results (corrected design) | Distribution of the test statistic | Wald vs score Z-score comparison | Distribution statistics for log(RR) | Type I error: Wald vs score test | Scenario sweep: impact of the Jensen correction | Discussion: why we apply the correction

Last update: 2026-05-01
Started: 2025-12-13

Multiple imputation for longitudinal negative binomial counts
Introduction | Statistical background | Negative binomial count model | Imputation draw | Bootstrap–MI combination | Worked example | Simulating longitudinal count data | Introducing missing data by mechanism | Running impute_nb() | Inspecting imputed values | Comparing imputed means by strategy | Pooled analysis with Rubin's rules (standard MI) | Bootstrap–MI for variance estimation | Using the building-block functions directly | Step 1 — Fit the GLMM | Step 2 — MAR imputation | Step 3 — MNAR reference-based imputation | Step 4 — Composite strategy (no model required) | Key considerations | Session info

Last update: 2026-04-21
Started: 2026-04-21

Sample size re-estimation example
Introduction | Trial setup and initial design | Initial sample size calculation | End-to-end helper workflow | Simulation | Interim analysis | Information computation | Sample size re-estimation | Final analysis | Updating bounds | References

Last update: 2026-04-11
Started: 2025-12-19

Non-inferiority and super-superiority designs
Non-inferiority design | Super-superiority design

Last update: 2025-12-20
Started: 2025-12-20

Group sequential simulation with completers analysis
Simulation setup | Simulation loop | Results summary | Visualization | Group sequential design evaluation

Last update: 2025-12-20
Started: 2025-12-13

Seasonal event simulation
Simulation setup | Define parameters | Run simulation | Analysis at a cut date | Seasonal and treatment effect estimation | Variance and information

Last update: 2025-12-20
Started: 2025-12-13

Readme and manuals

Help Manual

Help pageTopics
Blinded sample size re-estimation for recurrent eventsblinded_ssr
Calculate blinded statistical informationcalculate_blinded_info
Check group sequential boundscheck_gs_bound
Compute statistical information at analysis timecompute_info_at_time
Cut data for completers analysiscut_completers
Cut simulated trial data at a calendar datecut_data_by_date cut_data_by_date.default cut_data_by_date.nb_sim_data cut_data_by_date.nb_sim_seasonal
Find calendar date for target completer countcut_date_for_completers
Method of Moments Estimation for Negative Binomial Parametersestimate_nb_mom
Fit a negative binomial GLMM for count imputationfit_nb_glmm
Find calendar date for target event countget_analysis_date
Determine analysis date based on criteriaget_cut_date
Group sequential design for negative binomial outcomesgsNBCalendar
Multiple imputation for longitudinal negative binomial countsimpute_nb
Apply the composite ICE strategy: replace post-ICE outcomes with baselineimpute_nb_composite
Impute missing counts under Missing at Random (MAR)impute_nb_mar
Impute missing counts under a reference-based MNAR assumptionimpute_nb_mnar_ref
Wald or score test for treatment effect using negative binomial modelmutze_test print.mutze_test
Simulate recurrent events with fixed follow-upnb_sim
Simulate recurrent events with seasonal ratesnb_sim_seasonal
Preview built pkgdown site in the browserpreview_pkgdown_site
Print method for gsNBsummary objectsprint.gsNBsummary
Print method for sample_size_nbinom_result objectsprint.sample_size_nbinom_result
Print method for sample_size_nbinom_summary objectsprint.sample_size_nbinom_summary
Launch the SSR Shiny prototyperun_ssr_shiny
Sample size calculation for negative binomial outcomessample_size_nbinom
Simulate group sequential clinical trial for negative binomial outcomessim_gs_nbinom
Simulate adaptive group sequential trials with sample size re-estimationsim_ssr_nbinom
Summarize group sequential simulation resultssummarize_gs_sim
Summarize adaptive SSR simulation resultssummarize_ssr_sim
Summary for gsNB objectssummary.gsNB
Summary for sample_size_nbinom_result objectssummary.sample_size_nbinom_result
Convert group sequential design to integer sample sizestoInteger toInteger.gsDesign toInteger.gsNB
Unblinded sample size re-estimation for recurrent eventsunblinded_ssr