ggcalibrate: The Calibration plot

View source: R/rap.R

ggcalibrateR Documentation

The Calibration plot

Description

ggcalibrate plots the stats::predicted events against the actual event rate

Usage

ggcalibrate(x1, x2 = NULL, y = NULL, n_knots = 5, ci_level = 0.95)

Arguments

x1

Either a logistic regression fitted using glm (base package) or lrm (rms package) or calculated probabilities (eg through a logistic regression model) of the baseline model. Must be between 0 & 1

x2

Either a logistic regression fitted using glm (base package) or lrm (rms package) or calculated probabilities (eg through a logistic regression model) of the new (alternative) model. Must be between 0 & 1

y

Binary of outcome of interest. Must be 0 or 1 (if fitted models are provided this is extracted from the fit which for an rms fit must have x = TRUE, y = TRUE).

n_knots

The curves are made by fitting a restricted cubic spline (rms package). The default 5-knots is usually enough.

ci_level

Confidence interval of the curve (default = 0.95).

Value

a ggplot

Examples

## Not run: 
data(data_risk)
y<-data_risk$outcome 
x1<-data_risk$baseline
x2<-data_risk$new
#e.g.
output <- ggcalibrate(x1, x2, y, models = "both") 

## End(Not run)

JohnPickering/risk-assessment-plot-package documentation built on July 3, 2023, 8:41 a.m.