Skip to contents

Fit the models required to assess calibration in the large (calibration intercept), calibration slope, and overall 'weak' calibration (see, e.g., Van Calster et al. 2019). Fits the models required to do the three likelihood ratio tests described by Miller et al. (1993) (see summary.logistic_cal).

Usage

logistic_cal(y, p)

Arguments

y

binary outcome

p

predicted probabilities (these will be logit transformed)

Value

an object of class logistic_cal containing glm results for calculating calibration intercept, calibration slope, and LRTs.

References

Van Calster, B., McLernon, D. J., Van Smeden, M., Wynants, L., & Steyerberg, E. W. (2019). Calibration: the Achilles heel of predictive analytics. BMC medicine, 17(1), 1-7.

Miller, M. E., Langefeld, C. D., Tierney, W. M., Hui, S. L., & McDonald, C. J. (1993). Validation of probabilistic predictions. Medical Decision Making, 13(1), 49-57.

Examples

library(pmcalibration)
# simulate some data
n <- 500
dat <- sim_dat(N = n, a1 = .5, a3 = .2)

# predictions
p <- with(dat, invlogit(.5 + x1 + x2 + x1*x2*.1))

logistic_cal(y = dat$y, p = p)
#> Logistic calibration intercept and slope:
#> 
#>                       Estimate Std. Error z value Pr(>|z|) lower upper
#> Calibration Intercept   -0.055      0.108   -0.51     0.61 -0.27  0.16
#> Calibration Slope        0.864      0.089   -1.54     0.12  0.70  1.04
#> 
#> z-value for calibration slope is relative to slope = 1.
#> lower and upper are the bounds of 95% profile confidence intervals.
#> 
#> Likelihood ratio tests (a = intercept, b = slope):
#> 
#>                                              statistic df Pr(>Chi)
#> Weak calibration - H0: a = 0, b = 1               2.49  2     0.29
#> Calibration in the large - H0: a = 0 | b = 1      0.26  1     0.61
#> Calibration slope - H0: b = 1 | a                 2.23  1     0.14