scalib_hare | R Documentation |
TODO: add description
scalib_hare( scalib_object, verbose = 0, hare_penalty = NULL, hare_max_dimension = NULL, hare_prophaz = FALSE, hare_additive = FALSE, hare_linear_risk = FALSE, hare_linear_time = FALSE, hare_fit = NULL )
scalib_object |
An object of class |
verbose |
(integer value) If 0, no output will be printed. If 1, some output will be printed. If 2, all output will be printed. |
hare_penalty |
the parameter to be used in the AIC criterion. The method chooses the number of knots that minimizes |
hare_max_dimension |
maximum dimension (default is |
hare_prophaz |
should the model selection be restricted to proportional hazards models? |
hare_additive |
should the model selection be restricted to additive models? |
hare_linear_risk |
(logical value) should the effect of risk be linear? |
hare_linear_time |
(logical value) should the effect of time be linear? |
hare_fit |
hare object. If |
an object of class scalib
# packages library(ggplot2) library(tidyr) library(dplyr) sc <- scalib(pred_risk = pbc_scalib$predrisk, pred_horizon = 2500, event_time = pbc_scalib$test$time, event_status = pbc_scalib$test$status) sc_hare <- scalib_hare(sc) print(sc_hare) data_gg <- sc_hare$data_outputs |> select(._id_., hare_data_plot) |> unnest(hare_data_plot) data_bins <- predrisk_bin_segments(sc_hare, bin_count = 30) |> mutate(._id_.) id_labels <- c(prop_hazard = "Cox proportional hazards", rsf_axis = "Random survival forest (axis based splitting)", gradient_booster = "Gradient boosted decision trees", rsf_oblique = "Random survival forest (oblique splitting)") ggplot(data_gg) + aes(x = predicted, y = observed) + geom_line() + geom_abline(col = 'grey', linetype = 2) + geom_hline(yintercept = 0, col = 'grey') + theme_bw() + theme(panel.grid = element_blank()) + coord_cartesian(xlim = c(0, 1), ylim = c(-0.1, 1)) + geom_segment(data = data_bins, size = 4, alpha = 0.50, col = 'grey', mapping = aes(x = x, y = y, xend = xend, yend = yend)) + facet_wrap(~._id_., labeller = labeller(._id_. = id_labels)) + labs(x = 'Predicted risk', y = 'Observed risk')
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.