R/calibPlot.R
calibration_plot.Rd
Title Create calibration plot based on observed and predicted outcomes.
calibration_plot(
data,
obs,
follow_up = NULL,
pred,
group = NULL,
nTiles = 10,
legendPosition = "right",
title = NULL,
x_lim = NULL,
y_lim = NULL,
xlab = "Prediction",
ylab = "Observation",
points_col_list = NULL,
data_summary = FALSE
)
Data include observed and predicted outcomes.
Name of observed outcome in the input data.
Name of follow-up time (if applicable) in the input data.
Name of first predicted outcome in the input data.
Name of grouping column (if applicable) in the input data.
Number of tiles (e.g., 10 for deciles) in the calibration plot.
Legend position on the calibration plot.
Title on the calibration plot.
Limits of x-axis on the calibration plot.
Limits of y-axis on the calibration plot.
Label of x-axis on the calibration plot.
Label of y-axis on the calibration plot.
Points' color on the calibration plot.
Logical indicates whether a summary of the predicted and observed outcomes. needs to be included in the output.
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).
library(predtools)
library(dplyr)
#>
#> Attaching package: ‘dplyr’
#> The following objects are masked from ‘package:stats’:
#>
#> filter, lag
#> The following objects are masked from ‘package:base’:
#>
#> intersect, setdiff, setequal, union
x <- rnorm(100, 10, 2)
y <- x + rnorm(100,0, 1)
data <- data.frame(x, y)
calibration_plot(data, obs = "x", pred = "y")
#> $calibration_plot
#>