Skip to content

Commit

Permalink
feat: plot confidence bands in plot_surv_roc_trend
Browse files Browse the repository at this point in the history
  • Loading branch information
sgibb committed Nov 30, 2022
1 parent a59625d commit fb5c938
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 9 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: ameld
Title: Data and Model of End-Stage Liver Disease used in the AMPEL Project
Version: 0.0.29
Date: 2022-11-28
Version: 0.0.30
Date: 2022-11-30
Description:
A dataset of patients evaluated for liver transplantation at the
University Hospital Leipzig from November 2012 to June 2015.
Expand Down
5 changes: 5 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

## Changes in development

## Changes in 0.0.30

- Print confidence intervals in `plot_surv_roc` legend.
- Plot confidence bands in `plot_surv_roc_trend`.

## Changes in 0.0.29

- Fix upper creatinine bound in `meld3`.
Expand Down
25 changes: 24 additions & 1 deletion R/plot.R
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,31 @@ plot_surv_roc_trend <- function(x,

for (i in seq(along = x)) {
lines(x[[i]]$times, x[[i]]$AUC, lwd = 2, col = col[i])
if (!is.null(x[[i]]$confint)) {
lines(
x[[i]]$times, x[[i]]$confint$CB_AUC[, 1L] / 100,
lwd = 2, lty = 2, col = col[i]
)
lines(
x[[i]]$times, x[[i]]$confint$CB_AUC[, 2L] / 100,
lwd = 2, lty = 2, col = col[i]
)
}
}
legend("bottomright", legend = names(x), col = col, lty = lty, bty = "n")

if (!is.null(x[[1L]]$confint))
legend(
"bottomright",
legend = c(
names(x),
paste(names(x[[1L]]$confint$C.alpha), "confidence bands")
),
col = c(col, "#808080"), lty = c(lty, 2), bty = "n"
)
else
legend(
"bottomright", legend = names(x), col = col, lty = lty, bty = "n"
)
}

#' Plot a table
Expand Down
12 changes: 6 additions & 6 deletions tests/testthat/_snaps/plot/plot-surv-roc.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit fb5c938

Please sign in to comment.