Description Usage Arguments Value Usage notes Examples
Produce a dose-toxicity curve with posterior credible intervals for the probability of toxicity at each dose. Optionally, display the target toxicity rate (for CRM and oCRM studies) or the target toxicity band (for nCRM studies).
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | doseToxicityGraph(
data,
dose = Dose,
lines = c("Mean", "Median"),
ribbons = list(quantile = "Q\\d*"),
quantiles = c(0.05, 0.1, 0.5, 0.9, 0.95),
colours = c(mean = "black", median = "blue", quantile = "steelblue"),
yLabel = "p(Toxicity)",
xLabel = "Dose",
labels = c(quantile = "Posterior CIs", lines = "Dose-tox curve", quantile1 =
"10%-90%", quantile2 = "20%-80%"),
targetTox = 0.33,
alphaRange = c(0.2, 0.4),
defaultLegends = TRUE,
pivot = NA
)
|
data |
the input tibble, created by |
dose |
the column in |
lines |
a vector of |
ribbons |
a list of sets of (pairs of) |
quantiles |
the numeric quantiles represented by the quantile
|
colours |
a named vector defining the colours to be used in the various plot elements. the names define the plot elemets, the values define the colour to be used in the corresponding element |
yLabel |
the text to be used to label the y axis |
xLabel |
the text to be used to label the x axis |
labels |
a named list of legend and category labels. The names define the legend titles and elements. The values define the text to label the corresponding element. See Usage notes below. |
targetTox |
a scalar or two element vector defining the target toxicity rate (if scalar) or band (if a vector). |
alphaRange |
a two element vector defining the upper and lower bounds for the alpha (1 minus the transparency) level used to paint all ribbons in the graph. |
defaultLegends |
if |
pivot |
Should |
a ggplot object containing the requested plot
TODO: Fix the colour of legend entries for ribbons. Their transparency is correct. TODO: Allow custom colour for the target toxicity rate/band TODO: Allow wild card specification for all ribbon specifications.
The input tibble is spread
so that Parameter
values become
column names for use in the plot.
The definition of ribbons is complex at first sight, but highly flexible. If
ribbons=list("ribbonA"=list(c("Stat1", "Stat2"), c(("Stat3", "Stat4"))))
then a single set of two ribbons will be produced. The first ribbon is
runs from Value
s corresponding to Parameter == "Stat1"
(the lower limit of the ribbon) to Value
s corresponding to
Parameter == "Stat2"
(the upper limit of the ribbon). The definition
of the second ribbon is similar. The ribbons are drawn in the order they
appear in the list and so there is an assumption that the ribbons get
narrower as the length of the list increases. In other words, after the input
tibble has been spread
, that Stat1 < Stat2 < Stat3 < Stat4.
Continuing the example above, if labels=c("ribbonA"="My ribbon label", "ribbonA1"="First category", "ribbonA2"="Second label")
then the corresponding legend has a title of "My ribbon label" and its two
entries are labelled "First category" and "Second category".
Quantile ribbons undergo special pre-processing. By default, quantiles are
flagged by Parameter
values of the form "Q<x>", where <x> is a
positive integer. First, if the quantiles
list contains the value 0.5
in its ith element, then Parameter
values of "Q<i>" are changed to
"Median". Then the remaining "Q<x>" values are paired. If there are n
remaining elements, the pairs are ("Q<1>", Q<n>"), ("Q<2>", Q<n-1>") and
so on. These pairs are then processed as described above.
1 2 3 4 5 6 7 8 9 | data(oCRMPosteriorShort)
x <- oCRMPosteriorShort %>%
tidy() %>%
augmentOCRMData() %>%
dplyr::filter(Parameter == "Prob", Index == 2)
doseToxicityGraph(
createDoseSummary(x) %>% dplyr::select(-N),
targetTox=c(0.15, 0.30),
pivot=TRUE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.