View source: R/ggcalibration.R
ggcalibration | R Documentation |
Assess a model's calibration via a calibration plot.
ggcalibration( data, y, x, n.groups = 10, conf.level = 0.95, ci.method = c("exact", "ac", "asymptotic", "wilson", "prop.test", "bayes", "logit", "cloglog", "probit"), geom_smooth.args = list(method = "loess", se = FALSE, formula = y ~ x, color = "black"), geom_errorbar.args = list(width = 0), geom_point.args = list(), geom_function.args = list(colour = "gray", linetype = "dashed") )
data |
a data frame |
y |
variable name of the outcome coded as 0/1 |
x |
variable name of the risk predictions |
n.groups |
number of groups |
conf.level |
level of confidence to be used in the confidence interval |
ci.method |
method to use to construct the interval.
See |
geom_smooth.args |
named list of arguments that will be passed
to |
geom_errorbar.args |
named list of arguments that will be passed
to |
geom_point.args |
named list of arguments that will be passed
to |
geom_function.args |
named list of arguments that will be passed
to |
ggplot
glm(response ~ age + marker + grade, trial, family = binomial) %>% broom::augment(type.predict = "response") %>% ggcalibration(y = response, x = .fitted, n.groups = 6) + ggplot2::xlim(0, 1) + ggplot2::labs(x = "Model Risk")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.