Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

wglm

Logistic Regression Using IPCW


Description

Logistic regression over multiple timepoints where right-censoring is handle using inverse probability of censoring weighting.

Usage

wglm(
  regressor.event,
  formula.censor,
  times,
  data,
  cause = NA,
  fitter = "coxph",
  product.limit = FALSE
)

Arguments

regressor.event

[formula] a formula with empty left hand side and the covariates for the logistic regression on the right hand side.

formula.censor

[formula] a formula used to fit the censoring model.

times

[numeric vector] time points at which to model the probability of experiencing an event.

data

[data.frame] dataset containing the time at which the event occured, the type of event, and regressors used to fit the censoring and logistic models.

cause

[character or numeric] the cause of interest. Defaults to the first cause.

fitter

[character] routine to fit the Cox regression models.

product.limit

[logical] if TRUE the survival is computed using the product limit estimator.

Details

First, a Cox model is fitted (argument formula.censor) and the censoring probabilities are computed relative to each timepoint (argument times) to obtain the censoring weights. Then, for each timepoint, a logistic regression is fitted with the appropriate censoring weights and where the outcome is the indicator of having experience the event of interest (argument cause) at or before the timepoint.

Value

an object of class "wglm".

Examples

library(survival)

set.seed(10)
n <- 250
tau <- 1:5
d <- sampleData(n, outcome = "competing.risks")
d$Y <- (d$event == 1)*(d$time <= tau[3])
d0 <- d[event!=0] ## remove censoring

## no censoring
e0.wglm <- wglm(regressor.event = ~ X1, formula.censor = Surv(time,event==0) ~ X1,
               times = tau, data = d0)
e0.glm <- glm(Y ~ X1, family = binomial, data = d0)

## censoring
e.wglm <- wglm(regressor.event = ~ X1, formula.censor = Surv(time,event==0) ~ X1,
               times = tau, data = d)

riskRegression

Risk Regression Models and Prediction Scores for Survival Analysis with Competing Risks

v2020.12.08
GPL (>= 2)
Authors
Thomas Alexander Gerds [aut, cre], Paul Blanche [ctb], Rikke Mortensen [ctb], Marvin Wright [ctb], Nikolaj Tollenaar [ctb], John Muschelli [ctb], Ulla Brasch Mogensen [ctb], Brice Ozenne [aut] (<https://orcid.org/0000-0001-9694-2956>)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.