Plots the conditional power together with the likelihood function.
Usage
# S3 method for class 'AnalysisResults'
plot(
x,
y,
...,
type = 1L,
nPlanned = NA_real_,
allocationRatioPlanned = NA_real_,
main = NA_character_,
xlab = NA_character_,
ylab = NA_character_,
legendTitle = NA_character_,
palette = "Set1",
legendPosition = "auto",
showSource = FALSE,
grid = 1,
plotSettings = NULL
)Arguments
- x
The analysis results at given stage, obtained from
getAnalysisResults().- y
Not available for this kind of plot (is only defined to be compatible to the generic plot function).
- ...
Optional plot arguments. Furthermore the following arguments can be defined:
thetaRange: A range of assumed effect sizes if testing means or a survival design was specified. Additionally, if testing means was selected,assumedStDev(assumed standard deviation) can be specified (default is1).piTreatmentRange: A range of assumed rates pi1 to calculate the conditional power. Additionally, if a two-sample comparison was selected,pi2can be specified (default is the value fromgetAnalysisResults()).directionUpper: Specifies the direction of the alternative, only applicable for one-sided testing; default isTRUEwhich means that larger values of the test statistics yield smaller p-values.thetaH0: The null hypothesis value, default is0for the normal and the binary case, it is1for the survival case. For testing a rate in one sample, a value thetaH0 in (0, 1) has to be specified for defining the null hypothesis H0:pi = thetaH0.
- type
The plot type (default = 1). Note that at the moment only one type (the conditional power plot) is available.
- nPlanned
The additional (i.e., "new" and not cumulative) sample size planned for each of the subsequent stages. The argument must be a vector with length equal to the number of remaining stages and contain the combined sample size from both treatment groups if two groups are considered. For survival outcomes, it should contain the planned number of additional events. For multi-arm designs, it is the per-comparison (combined) sample size. For enrichment designs, it is the (combined) sample size for the considered subpopulation.
- allocationRatioPlanned
The planned allocation ratio
n1 / n2for a two treatment groups design, default is1. For multi-arm designs, it is the allocation ratio relating the active arm(s) to the control. For simulating means and rates for a two treatment groups design, it can be a vector of lengthkMax, the number of stages. It can be a vector of lengthkMax, too, for multi-arm and enrichment designs. In these cases, a change of allocating subjects to treatment groups over the stages can be assessed. Note that internallyallocationRatioPlannedis treated as a vector of lengthkMax, not a scalar.- main
The main title, default is
"Dataset".- xlab
The x-axis label, default is
"Stage".- ylab
The y-axis label.
- legendTitle
The legend title, default is
"".- palette
The palette, default is
"Set1".- legendPosition
The legend position. The default,
"auto", measures the legend and chooses among six inside positions by minimizing overlap with points, line segments, reference lines, bars, boxes, and error bars. Long labels are wrapped and entries arranged vertically in automatic mode. Oversized legends and faceted plots use the outside right position. This heuristic uses the current graphics device (seven inches square when no device is open); resizing may require recreating the plot or setting a position explicitly. Manual positions are:-1or"none": hide the legend"left","right","bottom","top": outside the plot0: default outside position with a square aspect ratio1,2,3: inside left, at the top, center, or bottom4,5,6: inside right, at the top, center, or bottomNA: retain the legacy plot-specific positioning rules
- showSource
Logical. If
TRUE, the parameter names of the object will be printed which were used to create the plot; that may be, e.g., useful to check the values or to create own plots with the base Rplotfunction. AlternativelyshowSourcecan be defined as one of the following character values:"commands": returns a character vector with plot commands"axes": returns a list with the axes definitions"test": all plot commands will be validated witheval(parse())and returned as character vector (function does not stop if an error occurs)"validate": all plot commands will be validated witheval(parse())and returned as character vector (function stops if an error occurs)
Note: no plot object will be returned if
showSourceis a character.- grid
An integer value specifying the output of multiple plots. By default (
1) a list ofggplotobjects will be returned. If agridvalue > 1 was specified, a grid plot will be returned if the number of plots is <= specifiedgridvalue; a list ofggplotobjects will be returned otherwise. Ifgrid = 0is specified, all plots will be created usingprintcommand and a list ofggplotobjects will be returned invisible. Note that one of the following packages must be installed to create a grid plot: 'ggpubr', 'gridExtra', or 'cowplot'.- plotSettings
An object of class
PlotSettingscreated bygetPlotSettings().
Examples
if (FALSE) { # \dontrun{
design <- getDesignGroupSequential(kMax = 2)
dataExample <- getDataset(
n = c(20, 30),
means = c(50, 51),
stDevs = c(130, 140)
)
result <- getAnalysisResults(design = design,
dataInput = dataExample, thetaH0 = 20,
nPlanned = c(30), thetaH1 = 1.5, stage = 1)
if (require(ggplot2)) plot(result, thetaRange = c(0, 100))
} # }
