Skip to contents

Draws the scaled total time on test transform, a distribution-free way of judging hazard shape before any model is fitted.

Usage

bd_ttt_plot(
  time,
  status = NULL,
  add = FALSE,
  col = "steelblue",
  lwd = 2,
  main = "Scaled total time on test",
  xlab = "i / n",
  ylab = expression(phi(i/n)),
  ...
)

Arguments

time

Numeric vector of observed times, or a fitted `"betadanish"` object, from which the times are taken.

status

Optional event indicator. Censored observations are dropped, since the transform is defined for complete samples.

add

Logical; add to an existing plot rather than starting a new one.

col, lwd

Colour and line width for the curve.

main, xlab, ylab

Labels.

...

Further graphical parameters.

Value

Invisibly, a data frame with the plotting coordinates `i_n` and `phi`, and an attribute `"shape"` giving the suggested hazard shape.

Details

For an ordered sample \(x_{(1)} \le \cdots \le x_{(n)}\), the scaled transform at \(i/n\) is $$\phi(i/n) = \frac{\sum_{j=1}^{i} x_{(j)} + (n-i)x_{(i)}} {\sum_{j=1}^{n} x_{(j)}}.$$

Read it against the diagonal. A curve entirely above the diagonal indicates an increasing hazard, entirely below a decreasing one; a curve that starts below and crosses above suggests a bathtub shape, and the reverse suggests a unimodal one. A curve close to the diagonal indicates a constant hazard, that is an exponential sample.

This is a shape diagnostic, not a test. It is worth drawing before choosing between the four-parameter model and its submodel, because it says which hazard shapes the data can support without assuming any of them.

See also

[bd_hazard_shape()] for the fitted counterpart

Examples

data(guinea_pig)
ttt <- bd_ttt_plot(guinea_pig$time)

attr(ttt, "shape")
#> [1] "unimodal (upside-down bathtub)"