viz_auc_svyglm: Weighted ROC Curve for Survey-Weighted Models

View source: R/viz_auc_svyglm.R

viz_auc_svyglmR Documentation

Weighted ROC Curve for Survey-Weighted Models

Description

Produces a weighted ROC curve and reports weighted AUC for survey-based models.

Usage

viz_auc_svyglm(
  fit_object,
  title = "Weighted ROC Curve",
  line_color = "#0072B2"
)

Arguments

fit_object

object obtain from logistic regression

title

Character. Plot title.

line_color

Character. ROC curve color.

Details

AUC is computed using, consistent with complex survey weighting.

Value

A ggplot object.

Examples

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)

svyCausalGLM documentation built on March 3, 2026, 5:08 p.m.