final_prog_svyglm: Prognostic-weighted survey GLM Prognostic-weighted survey GLM

View source: R/final_prog_svyglm.R

final_prog_svyglmR Documentation

Prognostic-weighted survey GLM Prognostic-weighted survey GLM

Description

Fits a survey-weighted logistic regression model using stabilized prognostic score weights derived from a model predicting the outcome conditional on baseline covariates and excluding the exposure effect. The function supports design-based inference under complex survey sampling while adjusting for confounding through prognostic weighting

Usage

final_prog_svyglm(
  data,
  dep_var,
  exposure,
  covariates,
  id_var,
  strata_var,
  weight_var,
  outcome_covariates = NULL,
  level = 0.95,
  ...
)

Arguments

data

Data frame

dep_var

Character; binary outcome

exposure

Character; exposure variable

covariates

Character vector; adjustment variables

id_var

Character; PSU

strata_var

Character; strata

weight_var

Character; survey weight

outcome_covariates

Character vector; optional covariates for final model

level

Numeric; CI level

...

Additional args to svyglm

Value

A list with:

  • prog_model: Prognostic svyglm.

  • final_model: Weighted outcome svyglm.

  • OR_table: Odds ratios with CI.

  • AUC: Weighted AUC.

  • data: Data with prognostic weights.

Examples

set.seed(123)
n <- 1000
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<-final_prog_svyglm(data = dat,
 dep_var = "outcome",
 exposure="exposure",
 covariates = c("age", "sex"),
 id_var = "psu",
 strata_var = "strata",
 weight_var = "weight",
 level = 0.95
)
names(fit)
fit$OR_table

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