View source: R/viz_auc_svyglm.R
| viz_auc_svyglm | R Documentation |
Produces a weighted ROC curve and reports weighted AUC for survey-based models.
viz_auc_svyglm(
fit_object,
title = "Weighted ROC Curve",
line_color = "#0072B2"
)
fit_object |
object obtain from logistic regression |
title |
Character. Plot title. |
line_color |
Character. ROC curve color. |
AUC is computed using, consistent with complex survey weighting.
A ggplot object.
set.seed(123)
n <- 100
dat <- data.frame(
psu = sample(1:10, n, replace = TRUE),
strata = sample(1:5, n, replace = TRUE),
weight = runif(n, 0.5, 2),
age = rnorm(n, 50, 10),
sex = factor(sample(c("Male", "Female"), n, replace = TRUE)),
exposure = rbinom(n, 1, 0.5)
)
dat$outcome <- rbinom(n, 1, plogis(-2 + 0.03*dat$age + 0.5*dat$exposure))
fit_example<-final_svyglm(dat, dep_var="outcome", covariates=c("age","sex"),
id_var="psu", strata_var="strata", weight_var="weight")
viz_auc_svyglm(fit_object=fit_example)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.