I am validating a weibull survival model. I need to change the number of bins to 10 in plotting the graph. I am not sure which parameter in the below code I should change.
It's hard to diagnose the problem without a reprex. See the FAQ. Especially since calibrate is not in base or stats, there's no way to know what str(cal_model) contains and what the calibrate_plot function expects by way of arguments. It doesn't have to be all the data or even your data if you can find a dataset that shows the same behavior.
The plot() function for the cal_model object is likely using the default binning for the data. To change the number of bins to 10, you can use the breaks argument in the hist() function, which is used within the plot() function.
You can modify the code to:
Copy code
calibration_plot <- plot(cal_model, breaks = seq(0, 1, by = 0.1))
This will create bins with edges at 0, 0.1, 0.2, ..., 1, which corresponds to 10 bins in total.
Alternatively, you could use the argument nclass = 10 to get the same result.
Copy code
calibration_plot <- plot(cal_model, nclass = 10)
This will change the number of bins to 10 for the histogram in the calibration plot.