Skip to content

Commit

Permalink
refactor: add legend argument
Browse files Browse the repository at this point in the history
  • Loading branch information
sgibb committed Jun 9, 2022
1 parent 71c7df7 commit a925bbe
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 13 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: ameld
Title: Data and Model of End-Stage Liver Disease used in the AMPEL Project
Version: 0.0.21
Version: 0.0.22
Description:
A dataset of patients evaluated for liver transplantation at the
University Hospital Leipzig from November 2012 to June 2015.
Expand Down
3 changes: 3 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@

## Changes in development

## Changes in 0.0.22

- Add `basehaz` for `cv.glmnet` class.
- Add `legend` argument to `plot.boot.glmnet`.

## Changes in 0.0.21

Expand Down
26 changes: 14 additions & 12 deletions R/bootstrap.R
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ plot.boot.glmnet <- function(x, col = head(viridisLite::viridis(3L), 2L),
.plot.sel.var(x, col = col, pch = pch, ...)
}

.plot.cal <- function(x, col, pch, ...) {
.plot.cal <- function(x, col, pch, legend = TRUE, ...) {
plot(NA, xlim = c(0L, 1L), ylim = c(0L, 1L), axes = FALSE, ann = FALSE)
title(main = "90 Day Survival", adj = 0L)
title(ylab = "Observed", adj = 1L)
Expand All @@ -194,17 +194,19 @@ plot.boot.glmnet <- function(x, col = head(viridisLite::viridis(3L), 2L),
.errorbars(
x$predicted.survival, se[, "lower"], se[, "upper"], col = col[1L]
)
legend(
"bottomright",
col = col[1L:2L],
pch = c(pch[1L], 4L),
legend = c(
"observed",
paste0("resampling optimism error added ",
"(based on ", length(x$models), " bootstrap samples)")
),
bty = "n"
)
if (legend) {
legend(
"bottomright",
col = col[1L:2L],
pch = c(pch[1L], 4L),
legend = c(
"observed",
paste0("resampling optimism error added ",
"(based on ", length(x$models), " bootstrap samples)")
),
bty = "n"
)
}
abline(0L, 1L, col = "#808080", lty = 2L, lwd = 1L)
}

Expand Down

0 comments on commit a925bbe

Please sign in to comment.