Generates the data needed for the calibration plot
Source:R/get_calibration_plot_data_prop.R
get_calibration_plot_data_prop.RdGenerates the data needed for the calibration plot. The calibration plot needs to separate the model predictions by risk groups. First the function separates the predictions in n_groups then computes the mean value of the model predictions and also the observed value. The observed value is the estimated value at the study time estimated using the proportion of events in each group.
Arguments
- model
Model generated with
mv_model_cox()ormv_model_logreg(). Needs thepredictionsparameter of the model, to generate it the functioncalculate_predictions()must be executed over the model. If we want to obtain also the recalibrated data the model must be initalize the recalibrated predictions withcalculate_predictions_recalibrated_type_1()andcalculate_predictions_recalibrated_type_2().- data
Data for what the observed predictions will be calculated.
- n_groups
Number of groups that must be calculated.
- type
Type of the predictions that the calibration plot data should be generated from:
"predictions_aggregated","predictions_recal_type_1"or"predictions_recal_type_2"
Value
tibble with the data ready to generate a calibration plot.
| group | prediction | observed |
| 1 | 0.03 | 0.05 |
| ... | ... | ... |
| n_group | 0.84 | 0.79 |
Examples
if (FALSE) { # \dontrun{
model |>
get_calibration_plot_data_surv(data = test_data, n_groups = 10, type = "predictions_aggregated")
} # }