plot.gsbMainOut: Plot methods

Description Usage Arguments Value Author(s) References See Also Examples

View source: R/package.r

Description

Methods for plotting the results of gsb().

Usage

 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
## S3 method for class 'gsbMainOut'
plot(x,
     what=c("all", "cumulative all",
            "both", "cumulative both",
            "sample size", "success", "futility",
            "success or futility", "indeterminate", "cumulative success",
            "cumulative futility", "cumulative success or futility",
            "cumulative indeterminate", "boundary",
            "std.boundary","delta.grid","patients"),
     range.delta = "default",
     stages = "default",
     delta.grid = TRUE,
     color = TRUE,
     smooth = 100,
     contour = TRUE, 
     export = FALSE,
     path = tempdir(),
     sliced = FALSE,
     range.control="default", ...)

## S3 method for class 'gsbSimulation'
plot(x,...)

## S3 method for class 'gsbDesign'
plot(x,...)

Arguments

x

object of appropriate class.

what

a character string to choose a plot. It should correspond to one level of OC$type where OC is an object of the output of gsb(). Additional possibilities are what = "all" to plot the success-, futility- and success or futility-probabilities, what = "cumulative all" to plot the cumulative success-, cumulative futility- and cumulative success or futility-probabilities, what = "boundary" or what = "std.boundary" to plot the bounds, what = "patients" for a histogram of the patients per stage and what = "delta.grid" to plot the grid of delta's.

range.delta

a vector of length 2. For choosing the plot limits manually set range.delta = c(min, max) for a Bayesian update on "treatment effect" or
range.delta = c(control.min, control.max, treatment.min, treatment.max) for a Bayesian update "per arm". If range.delta = "default" the range of the plot is chosen so that all delta's are covered.

stages

a vector of length 2 containing the number of the lowest and highest stage, which should be plotted. If stages = "default" all stages are plotted (expect for what = "sample size" where only the last stage is plotted.)

delta.grid

logical. If TRUE the delta grid is plotted too.

color

logical. If TRUE the plot is colored.

smooth

a vector of length 1. A higher number makes the plot 'smoother' if type.update = "per arm".

contour

logical. If TRUE contour lines are added to the plot.

export

logical. If TRUE the plot is save as .png-file.

path

character. to specify the location to which to table should be exported. the default 'tempdir()' exports the table to a temporary directory.

sliced

logical. If TRUE the contour plot for type.update = "per arm" is shown in several 2D plots. In order to use this option the argument grid.type of gsbSimulation() has to be sliced.

range.control

a vector of length 2 or \"default\". If special = TRUE the range of the control values can be set manually as vector c(min, max).

...

further arguments passed to or from other methods.

Value

Returns an object of class "trellis"

Author(s)

Florian Gerber <florian.gerber@math.uzh.ch>, Thomas Gsponer

References

uses the R-package 'lattice'.

See Also

gsb, xyplot

Examples

 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
## please see examples of function 'gsb'. 
## --------------------------------------


## --------------------------------------
## alternative plots can be created for example
## with package 'ggplot2'.

des <- gsbDesign(nr.stages=2,
                     patients=10,
                     sigma=10,
                     criteria.success=c(0,0.8, 7, 0.5),
                     criteria.futility=c(2,0.8),
                     prior.difference="non-informative")

sim <- gsbSimulation(truth=c(-10,20,60),
                             type.update="treatment effect")


x <- gsb(des,sim)

## get data.frame with operating characteristics
datgraph <- x$OC


## prepare for plot
sub <- c("success", "futility", "success or futility")
datgraph2 <- subset(datgraph,datgraph$type %in% sub)
datgraph2$type <- as.factor(paste(datgraph2$type))
datgraph2$value[datgraph2$type=="cumulative success or futility"] <-
1-datgraph2$value[datgraph2$type=="cumulative success or futility"]
levels(datgraph2$type) <- c("1)cumulative futility" ,"3)cumulative success","2)indeterminate")
datgraph2$type=as.factor(paste(datgraph2$type))
levels(datgraph2$type) <- c("cumulative futility" ,"indeterminate","cumulative success")
datgraph2 <- datgraph2[order(datgraph2$delta),]


## plots
p1 <- qplot(delta,value,geom="blank",color=type,facets=.~stage,data=datgraph2,
xlab=expression(delta))

p1+geom_line(size=1.5)+scale_color_manual(values = c("cumulative futility" = "dark red",
"indeterminate" = "orange", "cumulative success" = "dark green"))

p2=p1+geom_area(aes(x = delta,y=value,fill=type))

p2+scale_fill_manual(values = c("cumulative futility" = "dark red",
"indeterminate" = "orange", "cumulative success" = "dark green"))

gsbDesign documentation built on Oct. 4, 2021, 9:07 a.m.