Compute stabilized and unstabilized weights, with or without censoring.
inverse_probability_weighting(
numerator = c("stabilized", "unstabilized"),
identifier,
baseline,
covariates,
treatment,
include_censor = FALSE,
censor,
obsdata
)
Inverse Probability Weights (Stabilized and Unstabilized) with and without censoring.
To choose between stabilized and unstabilized weights.
Name of the column of the unique identifier.
Name of the baseline covariates.
Name of the time-varying covariates.
Name of the time-varying treatment.
Logical value TRUE/FALSE to include or not a censoring variable.
Name of the censoring variable.
Observed data in wide format.
Awa Diop, Denis Talbot
obsdata = gendata(n = 1000, format = "wide",total_followup = 3, seed = 945)
baseline_var <- c("age","sex")
covariates <- list(c("hyper2011", "bmi2011"),
c("hyper2012", "bmi2012"),c("hyper2013", "bmi2013"))
treatment_var <- c("statins2011","statins2012","statins2013")
stabilized_weights = inverse_probability_weighting(numerator = "stabilized",
identifier = "id", covariates = covariates, treatment = treatment_var,
baseline = baseline_var, obsdata = obsdata)
Run the code above in your browser using DataLab