wallyPlot: Wally plots to assess calibration of a risk or survival...

Description Usage Arguments Value Author(s) References Examples

View source: R/wallyPlot.R

Description

##' Wally plots to assess calibration of a risk or survival prediction

Usage

1
2
3
4
wallyPlot(object, time, formula, data, cause = 1, q = 10, ylim,
  hanging = FALSE, seed = NULL, mar = c(4.1, 4.1, 2, 2),
  colbox = "red", verbose = TRUE, col = c("grey90", "grey30"),
  xlab = "Risk groups", labels = "quantiles.labels", ...)

Arguments

object

Probabilistic survival predictions or probabilistic event risk predictions evaluated at time for the subjects in data. Either given in form of a numeric vector of probabilistic predictions or as an object which has a predictRisk method

time

Time interest for evaluating calibration of the predictions.

formula

A survival or event history formula. The left hand side is used to compute the expected event status. If formula is missing, try to extract a formula from the first element in object.

data

A data frame in which to validate the prediction models and to fit the censoring model. If data is missing, try to extract a data set from the first element in object.

cause

For competing risks settings the cause of interest.

q

The number of quantiles. Defaults to 10.

ylim

Limits of y-axis. If missing the function tries to find appropriate limits based on the simulated and real data.

hanging

If TRUE, hang bars corresponding to observed frequencies at the value of the corresponding prediction.

seed

A seed value to make results reproducible.

mar

Plot margins passed to par.

colbox

Color of the box which identifies the real data calibration plot.

verbose

If TRUE warn about missing formula and data.

col

Colour of the bars.

xlab

Label for x-axis

labels

Label below the bars. Either "quantiles" or "quantiles.label"

...

Further arguments passed to the subroutine wallyCalPlot and if hanging is TRUE also to subroutine lines.

Value

List of simulated and real data.

Author(s)

Paul F. Blanche <paulfblanche@gmail.com> and Thomas A. Gerds <tag@biostat.ku.dk>

References

Blanche P, Gerds T A, Ekstrom C T (2017). The Wally plot approach to assess the calibration of clinical prediction models, submitted.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# Survival setting
library(prodlim)
library(data.table)
library(survival)
set.seed(180)
d = SimSurv(180)
f = coxph(Surv(time,status)~X1+X2,data=d,x=TRUE)
## Not run: 
wallyPlot(f,
          time=4,
          q=10,
          data=d,
          formula=Surv(time,status)~1)
 wallyPlot(f,
          time=4,
          q=10,
          hanging=TRUE,
          data=d,
          formula=Surv(time,status)~1)

## End(Not run)

# Competing risks setting
library(prodlim)
library(survival)
library(riskRegression)
set.seed(180)
d2 = SimCompRisk(180)
f2 = CSC(Hist(time,event)~X1+X2,data=d2)
## Not run: 
wallyPlot(f2,
          time=5,
          q=3,
          hanging=TRUE,
          data=d2,
          formula=Hist(time,event)~1)
          

## End(Not run)

# Reproduce Wally plots presented in Blanche et al. (2017)
## Not run: 
data(threecity)
wallyPlot(threecity$pi,
time=5,
hanging=TRUE,
formula=Hist(time,status)~1,
data=threecity,
ylim=c(-.1,.25),
seed= 511,
hline.lwd=3,
mar=c(1.01, 4.1, 1.15, 2))

## End(Not run)

## Not run: 
data(divat)
wallyPlot(divat$pi,
time=5,
hanging=TRUE,
formula=Hist(time,status)~1,
data=divat,
ylim=c(-.1,.60),
seed= 123459,
hline.lwd=3,
mar=c(1.01, 4.1, 1.15, 2))

## End(Not run)

wally documentation built on Oct. 30, 2019, 5:07 p.m.

Related to wallyPlot in wally...