The functions `sfTruncated()`

and `sfTrimmed`

apply any other spending function over a restricted range.
This allows eliminating spending for early interim analyses when you desire not to stop for the bound being specified; this is usually applied to eliminate early tests for a positive efficacy finding.
The truncation can come late in the trial
if you desire to stop a trial any time after, say, 90 percent of information is available
and an analysis is performed.
This allows full Type I error spending if the final analysis occurs early.
Both functions set cumulative spending to 0 below a 'spending interval' in the interval [0,1], and set cumulative spending to 1 above this range.
`sfTrimmed()`

otherwise does not change an input spending function that is specified; probably the preferred and more intuitive method in most cases.
`sfTruncated()`

resets the time scale on which the input spending function is computed to the 'spending interval.'

`sfGapped()`

allows elimination of analyses after some time point in the trial; see details and examples.

1 2 3 |

`alpha` |
Real value |

`t` |
A vector of points with increasing values from 0 to 1, inclusive. Values of the proportion of sample size or information for which the spending function will be computed. |

`param` |
a list containing the elements sf (a spendfn object such as sfHSD), trange (the range over which the spending function increases from 0 to 1; 0 <= trange[1]<trange[2] <=1; for sfGapped, trange[1] must be > 0), and param (null for a spending function with no parameters or a scalar or vector of parameters needed to fully specify the spending function in sf). |

`sfTrimmed`

simply computes the value of the input spending function and parameters in the sub-range of [0,1], sets spending to 0 below this range and sets spending to 1 above this range.

`sfGapped`

spends outside of the range provided in trange. Below trange, the input spending function is used.
Above trange, full spending is used; i.e., the first analysis performed above the interval in trange is the final analysis.
As long as the input spending function is strictly increasing, this means that the first interim in the interval trange is the final interim analysis for the bound being specified.

`sfTruncated`

compresses spending into a sub-range of [0,1].
The parameter `param$trange`

specifies the range over which spending is to occur.
Within this range, spending is spent according to the spending function specified in
`param$sf`

along with the corresponding spending function parameter(s) in
`param$param`

.
See example using `sfLinear`

that spends uniformly over specified range.

An object of type `spendfn`

. See `Spending function overview`

for further details.

The manual is not linked to this help file, but is available in library/gsdesign/doc/gsDesignManual.pdf in the directory where R is installed.

Keaven Anderson keaven\_anderson@merck.

Jennison C and Turnbull BW (2000), *Group Sequential Methods with Applications to Clinical Trials*.
Boca Raton: Chapman and Hall.

Spending function overview, `gsDesign`

, gsDesign package overview

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | ```
# Eliminate efficacy spending forany interim at or before 20 percent of information.
# Complete spending at first interim at or after 80 percent of information.
tx <- (0:100)/100
s<-sfHSD(alpha=.05,t=tx,param=1)$spend
x <- data.frame(t=tx,Spending=s,sf="Original spending")
param <- list(trange=c(.2,.8),sf=sfHSD,param=1)
s<-sfTruncated(alpha=.05,t=tx,param=param)$spend
x <- rbind(x, data.frame(t=tx,Spending=s,sf="Truncated"))
s<-sfTrimmed(alpha=.05,t=tx,param=param)$spend
x <- rbind(x, data.frame(t=tx,Spending=s,sf="Trimmed"))
s <- sfGapped(alpha=.05,t=tx,param=param)$spend
x <- rbind(x, data.frame(t=tx,Spending=s,sf="Gapped"))
ggplot(x,aes(x=t,y=Spending,col=sf))+geom_line()
# now apply the sfTrimmed version in gsDesign
# initially, eliminate the early efficacy analysis
# note: final spend must occur at > next to last interim
x<-gsDesign(k=4, n.fix=100, sfu=sfTrimmed,
sfupar=list(sf=sfHSD, param=1, trange=c(.3,.9)))
# first upper bound=20 means no testing there
gsBoundSummary(x)
# now, do not eliminate early efficacy analysis
param <- list(sf=sfHSD, param=1, trange=c(0,.9))
x<-gsDesign(k=4, n.fix=100, sfu=sfTrimmed, sfupar=param)
# The above means if final analysis is done a little early, all spending can occur
# Suppose we set calendar date for final analysis based on
# estimated full information, but come up with only 97 pct of plan
xA <- gsDesign(k=x$k, n.fix=100, n.I=c(x$n.I[1:3],.97*x$n.I[4]),
test.type=x$test.type,
maxn.IPlan=x$n.I[x$k],
sfu=sfTrimmed, sfupar=param)
# now accelerate without the trimmed spending function
xNT<- gsDesign(k=x$k, n.fix=100, n.I=c(x$n.I[1:3],.97*x$n.I[4]),
test.type=x$test.type,
maxn.IPlan=x$n.I[x$k],
sfu=sfHSD, sfupar=1)
# Check last bound if analysis done at early time
x$upper$bound[4]
# Now look at last bound if done at early time with trimmed spending function
# that allows capture of full alpha
xA$upper$bound[4]
# With original spending function, we don't get full alpha and therefore have
# unnecessarily stringent bound at final analysis
xNT$upper$bound[4]
# note that if the last analysis is LATE, all 3 approaches should give the same
# final bound that has a little larger z-value
xlate <- gsDesign(k=x$k, n.fix=100, n.I=c(x$n.I[1:3],1.25*x$n.I[4]),
test.type=x$test.type,
maxn.IPlan=x$n.I[x$k],
sfu=sfHSD, sfupar=1)
xlate$upper$bound[4]
# eliminate futility after the first interim analysis
# note that by setting trange[1] to .2, the spend at t=.2 is used for the first
# interim at or after 20 percent of information
x <- gsDesign(n.fix=100,sfl=sfGapped,sflpar=list(trange=c(.2,.9),sf=sfHSD,param=1))
``` |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.