gsDesign function - RDocumentation (2024)

Description

gsDesign() is used to find boundaries and trial size required for agroup sequential design.

Many parameters normally take on default values and thus do not requireexplicit specification. One- and two-sided designs are supported. Two-sideddesigns may be symmetric or asymmetric. Wang-Tsiatis designs, includingO'Brien-Fleming and Poco*ck designs can be generated. Designs with commonspending functions as well as other built-in and user-specified functionsfor Type I error and futility are supported. Type I error computations forasymmetric designs may assume binding or non-binding lower bounds. The printfunction has been extended using print.gsDesign() to printgsDesign objects; see examples.

The user may ignore the structure of the value returned by gsDesign()if the standard printing and plotting suffice; see examples.

delta and n.fix are used together to determine what samplesize output options the user seeks. The default, delta=0 andn.fix=1, results in a ‘generic’ design that may be used withany sampling situation. Sample size ratios are provided and the usermultiplies these times the sample size for a fixed design to obtain thecorresponding group sequential analysis times. If delta>0,n.fix is ignored, and delta is taken as the standardizedeffect size - the signal to noise ratio for a single observation; forexample, the mean divided by the standard deviation for a one-sample normalproblem. In this case, the sample size at each analysis is computed. Whendelta=0 and n.fix>1, n.fix is assumed to be the samplesize for a fixed design with no interim analyses. See examples below.

Following are further comments on the input argument test.type whichis used to control what type of error measurements are used in trial design.The manual may also be worth some review in order to see actual formulas forboundary crossing probabilities for the various options. Options 3 and 5assume the trial stops if the lower bound is crossed for Type I and Type IIerror computation (binding lower bound). For the purpose of computing TypeI error, options 4 and 6 assume the trial continues if the lower bound iscrossed (non-binding lower bound); that is a Type I error can be made bycrossing an upper bound after crossing a previous lower bound.Beta-spending refers to error spending for the lower bound crossingprobabilities under the alternative hypothesis (options 3 and 4). In thiscase, the final analysis lower and upper boundaries are assumed to be thesame. The appropriate total beta spending (power) is determined by adjustingthe maximum sample size through an iterative process for all options. Sinceoptions 3 and 4 must compute boundary crossing probabilities under both thenull and alternative hypotheses, deriving these designs can take longer thanother options. Options 5 and 6 compute lower bound spending under the nullhypothesis.

Usage

gsDesign( k = 3, test.type = 4, alpha = 0.025, beta = 0.1, astar = 0, delta = 0, n.fix = 1, timing = 1, sfu = sfHSD, sfupar = -4, sfl = sfHSD, sflpar = -2, tol = 1e-06, r = 18, n.I = 0, maxn.IPlan = 0, nFixSurv = 0, endpoint = NULL, delta1 = 1, delta0 = 0, overrun = 0, usTime = NULL, lsTime = NULL)

# S3 method for gsDesignxtable( x, caption = NULL, label = NULL, align = NULL, digits = NULL, display = NULL, ...)

Value

An object of the class gsDesign. This class has the followingelements and upon return from gsDesign() contains:

k

Asinput.

test.type

As input.

alpha

As input.

beta

Asinput.

astar

As input, except when test.type=5 or 6and astar is input as 0; in this case astar is changed to1-alpha.

delta

The standardized effect size for which thedesign is powered. Will be as input to gsDesign() unless it was inputas 0; in that case, value will be computed to give desired power for fixeddesign with input sample size n.fix.

n.fix

Sample sizerequired to obtain desired power when effect size is delta.

timing

A vector of length k containing the portion of thetotal planned information or sample size at each analysis.

tol

Asinput.

r

As input.

n.I

Vector of length k. If valuesare input, same values are output. Otherwise, n.I will contain thesample size required at each analysis to achieve desired timing andbeta for the output value of delta. If delta=0 wasinput, then this is the sample size required for the specified groupsequential design when a fixed design requires a sample size ofn.fix. If delta=0 and n.fix=1 then this is the relativesample size compared to a fixed design; see details and examples.

maxn.IPlan

As input.

nFixSurv

As input.

nSurv

Samplesize for Lachin and Foulkes method when nSurvival is used for fixeddesign input. If nSurvival is used to compute n.fix, thennFixSurv is inflated by the same amount as n.fix and stored innSurv. Note that if you use gsSurv for time-to-event samplesize, this is not needed and a more complete output summary is given.

endpoint

As input.

delta1

As input.

delta0

As input.

overrun

As input.

usTime

As input.

lsTime

As input.

upper

Upper bound spending function,boundary and boundary crossing probabilities under the NULL and alternatehypotheses. See vignette("SpendingFunctionOverview") and manual for furtherdetails.

lower

Lower bound spending function, boundary and boundarycrossing probabilities at each analysis. Lower spending is under alternativehypothesis (beta spending) for test.type=3 or 4. Fortest.type=2, 5 or 6, lower spending is under the nullhypothesis. For test.type=1, output value is NULL. Seevignette("SpendingFunctionOverview") and manual.

theta

Standarizedeffect size under null (0) and alternate hypothesis. If delta isinput, theta[1]=delta. If n.fix is input, theta[1] iscomputed using a standard sample size formula (pseudocode):((Zalpha+Zbeta)/theta[1])^2=n.fix.

falseprobnb

Fortest.type=4 or 6, this contains false positive probabilitiesunder the null hypothesis assuming that crossing a futility bound does notstop the trial.

en

Expected sample size accounting for earlystopping. For time-to-event outcomes, this would be the expected number ofevents (although gsSurv will give expected sample size). Forinformation-based-design, this would give the expected information when thetrial stops. If overrun is specified, the expected sample sizeincludes the overrun at each interim.

An object of class "xtable" with attributes specifying formatting options for a table

Arguments

k

Number of analyses planned, including interim and final.

test.type

1=one-sided
2=two-sided symmetric
3=two-sided, asymmetric, beta-spending with binding lower bound
4=two-sided, asymmetric, beta-spending with non-binding lower bound
5=two-sided, asymmetric, lower bound spending under the nullhypothesis with binding lower bound
6=two-sided, asymmetric,lower bound spending under the null hypothesis with non-binding lower bound.
See details, examples and manual.

alpha

Type I error, always one-sided. Default value is 0.025.

beta

Type II error, default value is 0.1 (90% power).

astar

Normally not specified. If test.type=5 or 6,astar specifies the total probability of crossing a lower bound atall analyses combined. This will be changed to \(1 - \)alpha whendefault value of 0 is used. Since this is the expected usage, normallyastar is not specified by the user.

delta

Effect size for theta under alternative hypothesis. This can beset to the standardized effect size to generate a sample size ifn.fix=NULL. See details and examples.

n.fix

Sample size for fixed design with no interim; used to findmaximum group sequential sample size. For a time-to-event outcome, inputnumber of events required for a fixed design rather than sample size andenter fixed design sample size (optional) in nFixSurv. See detailsand examples.

timing

Sets relative timing of interim analyses. Default of 1produces equally spaced analyses. Otherwise, this is a vector of lengthk or k-1. The values should satisfy 0 < timing[1] <timing[2] < ... < timing[k-1] < timing[k]=1.

sfu

A spending function or a character string indicating a boundarytype (that is, “WT” for Wang-Tsiatis bounds, “OF” forO'Brien-Fleming bounds and “Poco*ck” for Poco*ck bounds). Forone-sided and symmetric two-sided testing is used to completely specifyspending (test.type=1, 2), sfu. The default value issfHSD which is a Hwang-Shih-DeCani spending function. See details,vignette("SpendingFunctionOverview"), manual and examples.

sfupar

Real value, default is \(-4\) which is anO'Brien-Fleming-like conservative bound when used with the defaultHwang-Shih-DeCani spending function. This is a real-vector for many spendingfunctions. The parameter sfupar specifies any parameters needed forthe spending function specified by sfu; this will be ignored forspending functions (sfLDOF, sfLDPoco*ck) or bound types(“OF”, “Poco*ck”) that do not require parameters.

sfl

Specifies the spending function for lower boundary crossingprobabilities when asymmetric, two-sided testing is performed(test.type = 3, 4, 5, or 6). Unlike the upperbound, only spending functions are used to specify the lower bound. Thedefault value is sfHSD which is a Hwang-Shih-DeCani spendingfunction. The parameter sfl is ignored for one-sided testing(test.type=1) or symmetric 2-sided testing (test.type=2). Seedetails, spending functions, manual and examples.

sflpar

Real value, default is \(-2\), which, with the defaultHwang-Shih-DeCani spending function, specifies a less conservative spendingrate than the default for the upper bound.

tol

Tolerance for error (default is 0.000001). Normally this will notbe changed by the user. This does not translate directly to number ofdigits of accuracy, so use extra decimal places.

r

Integer value controlling grid for numerical integration as inJennison and Turnbull (2000); default is 18, range is 1 to 80. Largervalues provide larger number of grid points and greater accuracy. Normallyr will not be changed by the user.

n.I

Used for re-setting bounds when timing of analyses changes frominitial design; see examples.

maxn.IPlan

Used for re-setting bounds when timing of analyses changesfrom initial design; see examples.

nFixSurv

If a time-to-event variable is used, nFixSurvcomputed as the sample size from nSurvival may be entered to havegsDesign compute the total sample size required as well as the numberof events at each analysis that will be returned in n.fix; this isrounded up to an even number.

endpoint

An optional character string that should represent the typeof endpoint used for the study. This may be used by output functions. Typesmost likely to be recognized initially are "TTE" for time-to-event outcomeswith fixed design sample size generated by nSurvival() and "Binomial"for 2-sample binomial outcomes with fixed design sample size generated bynBinomial().

delta1

delta1 and delta0 may be used to storeinformation about the natural parameter scale compared to delta thatis a standardized effect size. delta1 is the alternative hypothesisparameter value on the natural parameter scale (e.g., the difference in twobinomial rates).

delta0

delta0 is the null hypothesis parameter value on thenatural parameter scale.

overrun

Scalar or vector of length k-1 with patients enrolledthat are not included in each interim analysis.

usTime

Default is NULL in which case upper bound spending time is determined by timing. Otherwise, this should be a vector of length k with the spending time at each analysis (see Details).

lsTime

Default is NULL in which case lower bound spending time is determined by timing. Otherwise, this should be a vector of length k with the spending time at each analysis (see Details).

x

An R object of class found among methods(xtable). See below on how to write additional method functions for xtable.

caption

Character vector of length 1 or 2 containing the table's caption or title. If length is 2, the second item is the "short caption" used when LaTeX generates a "List of Tables". Set to NULL to suppress the caption. Default value is NULL.

label

Character vector of length 1 containing the LaTeX label or HTML anchor. Set to NULL to suppress the label. Default value is NULL.

align

Character vector of length equal to the number of columns of the resulting table, indicating the alignment of the corresponding columns. Also, "|" may be used to produce vertical lines between columns in LaTeX tables, but these are effectively ignored when considering the required length of the supplied vector. If a character vector of length one is supplied, it is split as strsplit(align, "")[[1]] before processing. Since the row names are printed in the first column, the length of align is one greater than ncol(x) if x is a data.frame. Use "l", "r", and "c" to denote left, right, and center alignment, respectively. Use "p{3cm}" etc. for a LaTeX column of the specified width. For HTML output the "p" alignment is interpreted as "l", ignoring the width request. Default depends on the class of x.

digits

Numeric vector of length equal to one (in which case it will be replicated as necessary) or to the number of columns of the resulting table or matrix of the same size as the resulting table, indicating the number of digits to display in the corresponding columns. Since the row names are printed in the first column, the length of the vector digits or the number of columns of the matrix digits is one greater than ncol(x) if x is a data.frame. Default depends on the class of x. If values of digits are negative, the corresponding values of x are displayed in scientific format with abs(digits) digits.

display

Character vector of length equal to the number of columns of the resulting table, indicating the format for the corresponding columns. Since the row names are printed in the first column, the length of display is one greater than ncol(x) if x is a data.frame. These values are passed to the formatC function. Use "d" (for integers), "f", "e", "E", "g", "G", "fg" (for reals), or "s" (for strings). "f" gives numbers in the usual xxx.xxx format; "e" and "E" give n.ddde+nn or n.dddE+nn (scientific format); "g" and "G" put x[i] into scientific format only if it saves space to do so. "fg" uses fixed format as "f", but digits as number of significant digits. Note that this can lead to quite long result strings. Default depends on the class of x.

...

Additional arguments. (Currently ignored.)

Author

Keaven Anderson keaven_anderson@merck.com

References

Jennison C and Turnbull BW (2000), Group SequentialMethods with Applications to Clinical Trials. Boca Raton: Chapman and Hall.Lan KK, DeMets DL (1989). Group sequential procedures: calendar versus information time. Statistics in medicine 8(10):1191-8.Liu, Q, Lim, P, Nuamah, I, and Li, Y (2012), On adaptive error spending approach for group sequential trials with random information levels. Journal of biopharmaceutical statistics; 22(4), 687-699.

See Also

vignette("gsDesignPackageOverview"), gsBoundSummary,plot.gsDesign,gsProbability, vignette("SpendingFunctionOverview"),

Normal xtable

Examples

Run this code

library(ggplot2)# symmetric, 2-sided design with O'Brien-Fleming-like boundaries# lower bound is non-binding (ignored in Type I error computation)# sample size is computed based on a fixed design requiring n=800x <- gsDesign(k = 5, test.type = 2, n.fix = 800)# note that "x" below is equivalent to print(x) and print.gsDesign(x)xplot(x)plot(x, plottype = 2)# Assuming after trial was designed actual analyses occurred after# 300, 600, and 860 patients, reset boundsy <- gsDesign( k = 3, test.type = 2, n.fix = 800, n.I = c(300, 600, 860), maxn.IPlan = x$n.I[x$k])y# asymmetric design with user-specified spending that is non-binding# sample size is computed relative to a fixed design with n=1000sfup <- c(.033333, .063367, .1)sflp <- c(.25, .5, .75)timing <- c(.1, .4, .7)x <- gsDesign( k = 4, timing = timing, sfu = sfPoints, sfupar = sfup, sfl = sfPoints, sflpar = sflp, n.fix = 1000)xplot(x)plot(x, plottype = 2)# same design, but with relative sample sizesgsDesign( k = 4, timing = timing, sfu = sfPoints, sfupar = sfup, sfl = sfPoints, sflpar = sflp)

Run the code above in your browser using DataLab

gsDesign function - RDocumentation (2024)
Top Articles
Latest Posts
Article information

Author: Barbera Armstrong

Last Updated:

Views: 6594

Rating: 4.9 / 5 (59 voted)

Reviews: 82% of readers found this page helpful

Author information

Name: Barbera Armstrong

Birthday: 1992-09-12

Address: Suite 993 99852 Daugherty Causeway, Ritchiehaven, VT 49630

Phone: +5026838435397

Job: National Engineer

Hobby: Listening to music, Board games, Photography, Ice skating, LARPing, Kite flying, Rugby

Introduction: My name is Barbera Armstrong, I am a lovely, delightful, cooperative, funny, enchanting, vivacious, tender person who loves writing and wants to share my knowledge and understanding with you.