This R Markdown document provides many different examples for creating plots with rpact and ggplot2, e.g. the plot
arguments type
and showSource
will be illustrated.
First, load the rpact package
## [1] '3.2.1'
design <- getDesignGroupSequential(kMax = 3,
typeOfDesign = "OF", sided = 1,
futilityBounds = c(0, 0.1))
plot(design, type = 1, showSource = TRUE)
## Source data of the plot (type 1):
## x-axis: design$informationRates
## y-axes:
## y1: c(design$futilityBounds, design$criticalValues[length(design$criticalValues)])
## y2: design$criticalValues
## Simple plot command examples:
## plot(design$informationRates, c(design$futilityBounds, design$criticalValues[length(design$criticalValues)]), type = "l")
## plot(design$informationRates, design$criticalValues, type = "l")
## Source data of the plot (type 3):
## x-axis: design$informationRates
## y-axis: design$stageLevels
## Simple plot command example:
## plot(design$informationRates, design$stageLevels, type = "l")
## Source data of the plot (type 4):
## x-axis: design$informationRates
## y-axis: design$alphaSpent
## Simple plot command example:
## plot(design$informationRates, design$alphaSpent, type = "l")
## Source data of the plot (type 5):
## x-axis: seq(-1, 1, 0.01)
## y-axes:
## y1: getPowerAndAverageSampleNumber(design, theta = seq(-1, 1, 0.01), nMax = 10)$overallEarlyStop
## y2: getPowerAndAverageSampleNumber(design, theta = seq(-1, 1, 0.01), nMax = 10)$calculatedPower
## Simple plot command examples:
## plot(seq(-1, 1, 0.01), getPowerAndAverageSampleNumber(design, theta = seq(-1, 1, 0.01), nMax = 10)$overallEarlyStop, type = "l")
## plot(seq(-1, 1, 0.01), getPowerAndAverageSampleNumber(design, theta = seq(-1, 1, 0.01), nMax = 10)$calculatedPower, type = "l")