Returns calibration plot (a ggplot object) and a dataset including summary statistics of
the predicted and observed outcomes (if data_summary set to be TRUE).
Arguments
data
Data include observed and predicted outcomes.
obs
Name of observed outcome in the input data.
follow_up
Name of follow-up time (if applicable) in the input data.
pred
Name of first predicted outcome in the input data.
group
Name of grouping column (if applicable) in the input data.
nTiles
Number of tiles (e.g., 10 for deciles) in the calibration plot.
legendPosition
Legend position on the calibration plot.
title
Title on the calibration plot.
x_lim
Limits of x-axis on the calibration plot.
y_lim
Limits of y-axis on the calibration plot.
xlab
Label of x-axis on the calibration plot.
ylab
Label of y-axis on the calibration plot.
points_col_list
Points' color on the calibration plot.
data_summary
Logical indicates whether a summary of the predicted and observed outcomes.
needs to be included in the output.
library(predtools)
library(dplyr)
x <- rnorm(100, 10, 2)
y <- x + rnorm(100,0, 1)
data <- data.frame(x, y)
calibration_plot(data, obs = "x", pred = "y")