library(ggplot2)
# making a gsDesign object first may be easiest...
x <- gsDesign()
# take a look at it
x
# default plot for gsDesign object shows boundaries
plot(x)
# \code{plottype=2} shows boundary crossing probabilities
plot(x, plottype = 2)
# now add boundary crossing probabilities and
# expected sample size for more theta values
y <- gsProbability(d = x, theta = x$delta * seq(0, 2, .25))
class(y)
# note that "y" below is equivalent to \code{print(y)} and
# \code{print.gsProbability(y)}
y
# the plot does not change from before since this is a
# gsDesign object; note that theta/delta is on x axis
plot(y, plottype = 2)
# now let's see what happens with a gsProbability object
z <- gsProbability(
k = 3, a = x$lower$bound, b = x$upper$bound,
n.I = x$n.I, theta = x$delta * seq(0, 2, .25)
)
# with the above form, the results is a gsProbability object
class(z)
z
# default plottype is now 2
# this is the same range for theta, but plot now has theta on x axis
plot(z)
Run the code above in your browser using DataLab