View source: R/predrisk_bin_segments.R
predrisk_bin_segments | R Documentation |
Bin predicted risk for plotting
predrisk_bin_segments( x, event_time = NULL, event_status = NULL, pred_horizon = NULL, by_event = FALSE, bin_count = 100, bin_yintercept = 0, bin_length = 1 )
x |
a numeric vector of predicted risk values or an object of
class |
event_time |
(numeric vector) observed event times |
event_status |
(numeric vector) observed event status. The values of this vector should be 0 (event censored) and 1 (event observed). |
pred_horizon |
(numeric value) the time of risk prediction. |
by_event |
If |
bin_count |
(integer value) total count of bins for downstream plots |
bin_yintercept |
(numeric value) where, relative to the y-axis, the bins should originate from on downstream plots. |
bin_length |
(numeric value) the length of the bins on downstream plots. |
a data.frame
object with values that can be plugged into
standard plotting tools, e.g., ggplot2::ggplot()
(see examples).
sc <- scalib(pred_risk = pbc_scalib$predrisk, pred_horizon = 2500, event_time = pbc_scalib$test$time, event_status = pbc_scalib$test$status) pbins <- predrisk_bin_segments(sc) print(pbins) pbins <- predrisk_bin_segments(x = pbc_scalib$predrisk$prop_hazard, event_time = pbc_scalib$test$time, event_status = pbc_scalib$test$status)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.