glm_cal | R Documentation |
fits a calibration curve via glm or Cox proportional hazards model
glm_cal(
y,
p,
x,
xp,
smooth,
time = NULL,
save_data = TRUE,
save_mod = TRUE,
pw = FALSE,
...
)
y |
binary or a time-to-event ( |
p |
predicted probabilities |
x |
predictor (could be transformation of |
xp |
values for plotting (same scale as |
smooth |
'rcs', 'ns', 'bs', or 'none' |
time |
time to calculate survival probabilities at (only relevant if |
save_data |
whether to save the data elements in the returned object |
save_mod |
whether to save the model in the returned object |
pw |
save pointwise standard errors for plotting |
list of class glm_cal
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))
glm_cal(y = dat$y, p = p, x = p, xp = NULL, smooth="ns", df=5)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.