Learn R Programming

cir (version 2.5.2)

plot.DRtrace: Plotting Methods for DRtrace, doseResponse Objects

Description

Plotting methods for doseResponse and DRtrace classes.

Usage

# S3 method for DRtrace
plot(
  x,
  xlab = "Patient Order",
  ylab = "Dose",
  shape = "circle",
  connect = TRUE,
  scol = 1,
  lcol = scol,
  obsvals = NULL,
  dosevals = NULL,
  offset = 0.1,
  ylim = NULL,
  size = 1,
  ...
)

# S3 method for doseResponse plot( x, xlab = "Dose", ylab = "Response", pch = "X", varsize = TRUE, refsize = NULL, connect = FALSE, scol = 1, dosevals = NULL, xlim = NULL, ... )

Arguments

x

the object, whether DRtrace or doseResponse

xlab, ylab

x-axis and y-axis labels passed on to plot

shape

the plotting shape (DRtrace only): 'circle' (default), 'square', or 'triangle'

connect

logical: whether to connect the symbols (generic plotting type 'b'). Default TRUE for DRtrace and FALSE for doseResponse

scol

The color of the main plotting symbols. Default 1 (the current palette's first color). Note: if you inadvertently use col to set the color, there will be an error message.

lcol

The color of the connecting lines, if relevant. Default same as scol.

obsvals

(DRtrace only) values to be plotted along the x-axis denoting observation order. If NULL (default), the graphical environment will choose which values to plot automatically, per default R behavior.

dosevals

Dose values to be plotted along the x-axis (plot.doseResponse) or y-axis (plot.DRtrace). Must be on the same scale as x$x. If NULL (default), those will be the doses in the dataset (i.e.,sort(unique(x$x))).

offset

(DRtrace only) In case of a cohort-based experiment, the relative vertical offset between symbols for outcomes within the same cohort (as fraction of dose spacing). Default 0.2.

ylim

(DRtrace only) Similar to the base plot() function's ylim argument. If kept NULL (default), will be determined by range(dosevals).

size

(DRtrace only) symbol size, analogous to cex (which you should not use, see note for scol above). A different name is used because there is some nuance related to enabling scol and lcol to differ, as well as accommodating larger symbols. Don't ask (but you can look at the code of course).

...

Other arguments passed on to plot.

pch

the plotting character (doseResponse only), the default being 'X' marks

varsize

(doseResponse only) logical, should symbol size vary by sample size? Default TRUE

refsize

(doseResponse only) a reference size by which the plotting sizes will be multiplied. Default is 1/sqrt(mean(dr$weight)), scaled so that if varsize = TRUE the weighted-average symbol size is 1. If varsize = FALSE, this argument is equivalent to cex in an ordinary x-y plot() call.

xlim

(doseResponse only) Analogous to the above.

Author

Assaf P. Oron <assaf.oron.at.gmail.com>

Details

Generic methods for dose-response trajectory/trace (DRtrace), and dose-response summary (doseResponse) class objects. The DRtrace plotting uses the typical convention of plotting dose-finding experimental trace, with dose levels (x) in the vertical axis and 1/0 responses (y) denoted via filled/empty symbols, respectively. In other words, this generic plotting method is only relevant for binary 0/1 outcomes. If cohort information is provided via x$cohort (i.e., multiple observations considered as collected together rather than each data point sequentially), then the plotting will respect cohort structure.

The doseResponse plotting has response rate on the y-axis and dose on the x-axis, and plots symbols whose area is proportional to the weights.

See Also

doseResponse, DRtrace

Examples

Run this code
## Summary of raw data from the notorious Neuenschwander et al. trial (Stat. Med., 2008)
## Note the use of the 'cohort' argument to specify the cohort order
neundatTrace = DRtrace(x = c(rep(1:4, c(3,4,5,4) ), 7, 7, rep(6,9)),
                       y = c(rep(0,16), 1,1, rep(c(0,0,1),2), 0,0,0), 
                       cohort = rep(1:8, c(3,4,5,4, 2, 3,3,3)) )
par(mar=c(3,3,3,1), mgp=c(2,.5,0), tcl=-0.25)
layout(t(1:2))
plot(neundatTrace ,main="N. et al. (2008) Trajectory", xlab = 'Cohort', dosevals = 1:8, 
          ylab="Ordinal Dose Level" ,cex.main=1.5, las = 1)

## Same data, in 'doseResponse' format with actual doses rather than dose levels
## We can create the object from scratch, or convert the DRtrace object
##    while putting in physical doses via the 'dosevals' argument.
neundatDose = doseResponse(neundatTrace, dosevals = c(1,2.5,5,10,20,25) )

plot(neundatDose ,main="N. et al. (2008) Final Dose-Toxicity", ylim=c(0,1), 
     dosevals = seq(0, 25, 5), xlab="Dose (mg/sq.m./wk)", ylab="Toxicity Response Curve (F)", 
     cex.main=1.5, las = 1)
## We can also convert the DRtrace object to doseResponse...
neundatLevel = doseResponse(neundatTrace)

### Now plotting the former, vs. IR/CIR estimates
neunCIR0 = cirPAVA(neundatDose,full=TRUE, adaptiveShrink = TRUE, target = 0.3)
lines(neunCIR0$shrinkage$x, neunCIR0$shrinkage$y)
legend(1,1, pch=c(4,NA), lty = 0:1, legend=c('Observations', 'CIR w/bias corr.'), bty='n')

Run the code above in your browser using DataLab