The plot()
function has been extended to work with objects returned by gsDesign()
and gsProbability()
.
For objects of type gsDesign
, seven types of plots are provided: zvalues at boundaries (default), power,
estimated treatment effects at boundaries,
conditional power at boundaries, spending functions, expected sample size, and Bvalues at boundaries.
For objects of type gsProbability
plots are available for zvalues at boundaries, power (default), estimated treatment effects at boundaries, conditional power, expected sample size and Bvalues at boundaries.
1 2 3 4 
x 
Object of class

plottype 
1=boundary plot (default for 2=power plot (default for 3=estimated treatment effect at boundaries, 4=conditional power at boundaries, 5=spending function plot
(only available if 6=expected sample size plot, and 7=Bvalues at boundaries. Character values for 
base 
Default is FALSE, which means ggplot2 graphics are used. If true, base graphics are used for plotting. 
... 
This allows many optional arguments that are standard when calling Other arguments include:

The intent is that many standard plot()
parameters will function as expected; exceptions to this rule exist.
In particular, main, xlab, ylab, lty, col, lwd, type, pch, cex
have been tested and work for most values of plottype
; one
exception is that type="l"
cannot be overridden when plottype=2
. Default values for labels depend on plottype
and
the class of x
.
Note that there is some special behavior for values plotted and returned
for power and expected sample size (ASN) plots for a gsDesign
object.
A call to x<gsDesign()
produces power and expected sample size for only two theta
values: 0 and x$delta
.
The call plot(x, plottype="Power")
(or plot(x,plottype="ASN"
) for a gsDesign
object produces power (expected sample size) curves and returns a gsDesign
object with theta
values determined as follows.
If theta
is nonnull on input, the input value(s) are used.
Otherwise, for a gsProbability
object, the theta
values from that object are used.
For a gsDesign
object where theta
is input as NULL
(the default), theta=seq(0,2,.05)*x$delta
) is used.
For a gsDesign
object, the xaxis values are rescaled to theta/x$delta
and the label for the xaxis theta / delta.
For a gsProbability
object, the values of theta
are plotted and are labeled as theta.
See examples below.
Estimated treatment effects at boundaries are computed dividing the Zvalues at the boundaries by the square root of n.I
at that analysis.
Spending functions are plotted for a continuous set of values from 0 to 1.
This option should not be used if a boundary is used or a pointwise spending function is used
(sfu
or sfl="WT", "OF", "Pocock"
or sfPoints
).
Conditional power is computed using the function gsBoundCP()
.
The default input for this routine is theta="thetahat"
which will compute the conditional power at each bound using the estimated treatment effect at that bound.
Otherwise, if the input is gsDesign
object conditional power is computed assuming theta=x$delta
, the original effect size for which the trial was planned.
Average sample number/expected sample size is computed using n.I
at each analysis times the probability of crossing a boundary at that analysis.
If no boundary is crossed at any analysis, this is counted as stopping at the final analysis.
Bvalues are Zvalues multiplied by sqrt(t)=sqrt(x$n.I/x$n.I[x$k])
.
Thus, the expected value of a Bvalue at an analysis is the true value of
theta multiplied by the proportion of total planned observations at that time.
See Proschan, Lan and Wittes (2006).
An object of class(x)
; in many cases this is the input value of x
, while in others x$theta
is replaced
and corresponding characteristics computed; see 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.com
Jennison C and Turnbull BW (2000), Group Sequential Methods with Applications to Clinical Trials. Boca Raton: Chapman and Hall.
Proschan, MA, Lan, KKG, Wittes, JT (2006), Statistical Monitoring of Clinical Trials. A Unified Approach. New York: Springer.
gsDesign package overview, gsDesign
, gsProbability
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24  # symmetric, 2sided design with O'BrienFleminglike boundaries
# lower bound is nonbinding (ignored in Type I error computation)
# sample size is computed based on a fixed design requiring n=100
x < gsDesign(k=5, test.type=2, n.fix=100)
x
# the following translate to calls to plot.gsDesign since x was
# returned by gsDesign; run these commands one at a time
plot(x)
plot(x, plottype=2)
plot(x, plottype=3)
plot(x, plottype=4)
plot(x, plottype=5)
plot(x, plottype=6)
plot(x, plottype=7)
# choose different parameter values for power plot
# start with design in x from above
y < gsProbability(k=5, theta=seq(0, .5, .025), x$n.I,
x$lower$bound, x$upper$bound)
# the following translates to a call to plot.gsProbability since
# y has that type
plot(y)

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.
All documentation is copyright its authors; we didn't write any of that.