Plots the conditional power together with the likelihood function.
# S3 method for AnalysisResults
plot(x, y, ..., type = 1L,
nPlanned = NA_real_, stage = x$getNumberOfStages(),
allocationRatioPlanned = NA_real_, main = NA_character_,
xlab = NA_character_, ylab = NA_character_, legendTitle = "",
palette = "Set1", legendPosition = NA_integer_, showSource = FALSE)
The analysis results at given stage, obtained from getAnalysisResults
.
Not available for this kind of plot (is only defined to be compatible to the generic plot function).
Optional ggplot2
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, an assumed standard deviation can be specified (default is 1).
piRange
: A range of assumed rates pi1 to calculate the conditional power.
Additionally, if a two-sample comparison was selected, pi2 can be specified (default is the value from
getAnalysisResults
).
directionUpper
: The direction of one-sided testing.
Default is directionUpper = TRUE
which means that larger values of the
test statistics yield smaller p-values.
thetaH0
: The null hypothesis value, default is 0 for the normal and the binary case,
it is 1 for 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.
The plot type (default = 1). Note that at the moment only one type (the conditional power plot) is available.
The sample size planned for the subsequent stages. It should be a vector with length equal to the remaining stages and is the overall sample size in the two treatment groups if two groups are considered.
The stage number (optional). Default: total number of existing stages in the data input used to create the analysis results.
The allocation ratio n1/n2 for two treatment groups planned for the subsequent stages, the default value is 1.
The main title, default is "Dataset"
.
The x-axis label, default is "Stage"
.
The y-axis label.
The legend title, default is ""
.
The palette, default is "Set1"
.
The position of the legend.
By default (NA_integer_
) the algorithm tries to find a suitable position.
Choose one of the following values to specify the position manually:
0
: legend position outside plot
1
: legend position left top
2
: legend position left center
3
: legend position left bottom
4
: legend position right top
5
: legend position right center
6
: legend position right bottom
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 plot
.
The conditional power is calculated only if effect size and sample size is specified.
# NOT RUN {
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))
# }
Run the code above in your browser using DataLab