ipw.survival | R Documentation |
This function allows to estimate confounder-adjusted survival curves by weighting the individual contributions by the inverse of the probability to be in the group (IPW).
ipw.survival(times, failures, variable, weights)
times |
A numeric vector with the follow up times. |
failures |
A numeric vector with the event indicators (0=right censored, 1=event). |
variable |
A numeric vector with the binary variable under interest (only two groups). |
weights |
The weights for correcting the contribution of each individual. By default, the weights are all equaled to 1 and the survival curves correspond to the usual Kaplan-Meier estimator. |
For instance, the weights
may be equal to 1/p
, where p
is the estimated probability of the individual to be in its group. The probabilities p
are often estimated by a logistic regression in which the dependent binary variable is the group. The possible confounding factors are the covariates of this model.
table.surv |
This data frame presents the survival probabilities ( |
Yohann Foucher <Yohann.Foucher@univ-poitiers.fr>
Florent Le Borgne <fleborgne@idbc.fr>
Le Borgne et al. Comparisons of the performances of different statistical tests for time-to-event analysis with confounding factors: practical illustrations in kidney transplantation. Statistics in medicine. 30;35(7):1103-16, 2016. <doi:10.1002/ sim.6777>
data(dataDIVAT2)
# adjusted Kaplan-Meier estimator by IPW
Pr0 <- glm(ecd ~ 1, family = binomial(link="logit"), data=dataDIVAT2)$fitted.values[1]
Pr1 <- glm(ecd ~ age + hla + retransplant, data=dataDIVAT2,
family=binomial(link = "logit"))$fitted.values
W <- (dataDIVAT2$ecd==1) * (1/Pr1) + (dataDIVAT2$ecd==0) * (1)/(1-Pr1)
res.akm <-ipw.survival(times=dataDIVAT2$times, failures=dataDIVAT2$failures,
variable=dataDIVAT2$ecd, weights=W)
plot(res.akm, ylab="Confounder-adjusted survival",
xlab="Time post-transplantation (years)", col=c(1,2), grid.lty=1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.