.claude/skills/gsDesign/SKILL.md
Guide users through classical group sequential trial design using the gsDesign R package. Use this skill when the user asks about: group sequential boundaries, spending functions (sfLDOF, sfHSD, sfPoints), sample size for time-to-event or binomial trials, gsDesign objects, plotting group sequential bounds, gsSurvPower for power computation, or harm bounds (test.type 7/8).
npx skillsauth add keaven/gsDesignSkills gsDesignInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Note: This skill targets gsDesign >= 3.9.0 (dev version at github.com/keaven/gsDesign).
Features marked (dev) may not be on CRAN yet. The CRAN llms.txt covers version 3.6.9.
references/llms.txt (source: https://gsDesign.ai)references/code_patterns.mdgsDesign() - Core boundary computation for group sequential designsgsSurv() / gsSurvCalendar() / nSurv() - Time-to-event design (sample size)gsSurvPower() - Power computation for survival designs (dev)nNormal() - Sample size for normal endpointsgsBinomialExact() - Exact binomial group sequential designgsBoundSummary() - Formatted summary tables of boundsgsProbability() - Boundary crossing probabilitiesgsCP() / gsBoundCP() - Conditional powerssrCP() - Sample size re-estimation based on conditional powerplot.gsDesign() - Plotting group sequential designshGraph() - Multiplicity graph visualizationtoInteger() - Round sample sizes to integerssequentialPValue() - Sequential p-value computationsfLDOF - Lan-DeMets O'Brien-Fleming: $2\Phi(-\Phi^{-1}(1-\alpha/2)/\sqrt{t})$sfHSD - Hwang-Shih-DeCani: $\alpha(1-e^{-\gamma t})/(1-e^{-\gamma})$; $\gamma<0$ conservative, $\gamma>0$ aggressivesfPower - Kim-DeMets power: $\alpha t^\rho$; $\rho=3$ is conservative (recommended)sfExponential - Exponential: $\alpha t^{-\nu}$; $\nu=0.8$ approximates O'Brien-Fleming with simpler form; conservative early spending compared to sfHSD or sfPower at same late spendingsfPoints - Pointwise (piecewise linear) spending at specified information fractionssfLinear - Linear spending: $\alpha t$sfXG - Xu-Garden conditional error spendingAll use the general form $\alpha(t; a, b) = \alpha F(a + b F^{-1}(t))$ where $F$ is a CDF. Given two desired spending points $(t_0, s_0)$ and $(t_1, s_1)$, solve $F^{-1}(s_i) = a + b F^{-1}(t_i)$ for the parameters $a, b$. In gsDesign, pass param = c(t0, t1, s0, s1) to fit automatically.
sfLogistic - Logistic CDF: $\alpha c(t/(1-t))^b / (1+c(t/(1-t))^b)$ where $c=e^a$. Used in GUSTO V trial and Merck trials. General purpose.sfNormal - Standard normal CDF. Nearly identical to sfLogistic in practice.sfCauchy - Cauchy CDF. Flat between fitted points; robust when analysis timing shifts.sfExtremeValue - Extreme value CDF: $\alpha\exp(-e^a(-\ln t)^b)$. Conservative early spending.sfExtremeValue2 - Flipped extreme value: $F(x) = 1-\exp(-\exp(x))$. Conservative early spending; useful for futility bound calibration (dev).sfTDist - t-distribution CDF (3 parameters: $a$, $b$, and df). Cauchy at df=1, normal at df=$\infty$; df provides continuous interpolation.sfBetaDist - Incomplete beta CDF with parameters $a>0, b>0$: $\alpha F_{a,b}(t)$. Fitted via nlminb() (nonlinear).Reference: Anderson KM, Clark JB. Fitting spending functions. Statist. Med. 2010; 29:321–327.
as_gt() - Convert summary tables to gt objectsas_rtf() - Save summary tables as RTF filesas_table() - Create summary table objectsxtable() - LaTeX/HTML table outputFor detailed code templates covering common workflows, read references/code_patterns.md.
Topics covered:
gsSurv() (piecewise rates, stratification)gsSurvCalendar()gsSurvPower() (sensitivity, what-if analyses) (dev)sfExtremeValue2 for calibrating futility bounds to target HR (dev)testLower for selective futility bound testing at specific analysestestBinomial() / nBinomial() for binomial Z-statistics and sample sizessrCP)hGraph()gsSurvPower(x = design, hr = ...) for sensitivity analyses without re-solving sample sizetoInteger() before reporting a designtoInteger() preserves testLower settings; earlier versions reset suppressed futility boundsFALSE suppresses futility at that analysisparam = c(t1, t2, u1, u2) fits sf(t1) = alpha*u1 and sf(t2) = alpha*u2. Choose sfCauchy for robustness to timing changes, sfExtremeValue/sfExtremeValue2 for conservative early spending, sfLogistic/sfNormal as general purpose defaults.c(t1, t2, u1, u2) for calibrating futility bounds to target a specific HRtestBinomial(x1=exp, x2=ctrl, n1=n_exp, n2=n_ctrl) gives positive Z when experimental is better; swapping x1/x2 reverses the signgsSurv() which combines sample size and boundary computationplannedCalendarTime gives unconditional power (events change with HR); targetEvents matches the gsDesign power plotusTime/lsTime in gsDesign() when spending should differ from information fractiontest.type = 1, 4, 6 (one-sided or non-binding futility). Based on Liu & Anderson (2008) Theorem 1: Type I error ≤ α for any stopping time τ, which is why non-binding futility and trial extension past an efficacy boundary preserve error control.graph_test_shortcut()) to test multiple hypotheses in group sequential trials while controlling FWER. See Maurer & Bretz (2013) and the graphicalMCP-gsDesign2 skill.gsSurvCalendar(spending = "calendar") spends less at early interimstesting
Guide users through weighted parametric group sequential design using the wpgsd R package. Use this skill when the user asks about: correlated test statistics across hypotheses, generate_bounds, closed_test, correlation matrices for nested populations, or parametric multiplicity adjustment with group sequential designs.
tools
Guide users through clinical trial simulation using the simtrial R package. Use this skill when the user asks about: simulating survival trials, simfix, sim_pw_surv, cutting data at calendar or event times, weighted logrank tests, MaxCombo tests, or simulation-based power.
tools
Guide users through confirmatory adaptive clinical trial design and analysis using the rpact R package. Use this skill when the user asks about: adaptive designs, sample size reassessment, conditional power, inverse normal combination test, Fisher combination test, multi-stage designs, or rpact design objects.
tools
Guide users through multi-endpoint group sequential trial simulation with multiplicity-controlled testing. Use this skill when the user asks about: simulating trials with OS, PFS, and ORR endpoints, illness-death model simulation with gsDesign bounds, sequential p-values in simulation loops, combining graphicalMCP with gsDesign for simulation-based operating characteristics, cumulative rejection probabilities, or building a full pipeline from design through simulation to multiplicity-adjusted testing.