plot.DRtrace: Plotting Methods for DRtrace, doseResponse Objects

View source: R/methods.r

plot.DRtraceR Documentation

Plotting Methods for DRtrace, doseResponse Objects

Description

Plotting methods for doseResponse and DRtrace classes.

Usage

## S3 method for class 'DRtrace'
plot(
  x,
  xlab = "Patient Order",
  ylab = "Dose",
  shape = "circle",
  connect = TRUE,
  mcol = 1,
  dosevals = NULL,
  offset = 0.2,
  ...
)

## S3 method for class 'doseResponse'
plot(
  x,
  xlab = "Dose",
  ylab = "Response",
  pch = "X",
  varsize = TRUE,
  refsize = sqrt(1/mean(x$weight)),
  connect = FALSE,
  mcol = 1,
  dosevals = 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

mcol

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

dosevals

Dose values to be plotted along the x-axis (plot.doseResponse) or y-axis (plot.DRtrace) . 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.

...

Other arguments passed on to plot.

Conversely, putting values on a different scale into dosevals, or even text labels instead of numbers, won't work. For the former, change the scale at the source data (i.e., in the plotted object). For the latter, sorry but no solution at present.

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.

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 circles, respectively. In other words, this generic plotting method is only relevant for binary 0/1 outcomes. 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.

Author(s)

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

See Also

doseResponse, DRtrace

Examples

## Summary of raw data from the notorious Neuenschwander et al. (Stat. Med., 2008) trial
## Note the use of the 'cohort' argument to specify the cohort order
neundatTrace = DRtrace(x = c(rep(1:4,each=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(4,4,4,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) Cohort Trace", xlab = 'Cohort', 
          ylab="Ordinal Dose Level" ,cex.main=1.5)

## Same data, in 'doseResponse' format with actual doses rather than dose levels
neundatDose = doseResponse(x=c(1,2.5,5,10,20,25), y = c(rep(0,4),2/9,1), wt = c(3,4,5,4,9,2) )
plot(neundatDose ,main="N. et al. (2008) Final Dose-Toxicity", ylim=c(0,1),
	xlab="Dose (mg/sq.m./wk)", ylab="Toxicity Response Curve (F)", cex.main=1.5)
## 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, type='b' ,pch=19)
legend(1,1, pch=c(4,19), legend=c('Observations', 'CIR w/bias corr.'), bty='n')

assaforon/cir documentation built on April 7, 2024, 12:23 p.m.