Free Access Week - Data Engineering + BI
Data Engineering and BI courses are free this week!
Free Access Week - Jun 2-8

trajmsm (version 0.1.3)

inverse_probability_weighting: Inverse Probability Weighting

Description

Compute stabilized and unstabilized weights, with or without censoring.

Usage

inverse_probability_weighting(
  numerator = c("stabilized", "unstabilized"),
  identifier,
  baseline,
  covariates,
  treatment,
  include_censor = FALSE,
  censor,
  obsdata
)

Value

Inverse Probability Weights (Stabilized and Unstabilized) with and without censoring.

Arguments

numerator

To choose between stabilized and unstabilized weights.

identifier

Name of the column of the unique identifier.

baseline

Name of the baseline covariates.

covariates

Name of the time-varying covariates.

treatment

Name of the time-varying treatment.

include_censor

Logical value TRUE/FALSE to include or not a censoring variable.

censor

Name of the censoring variable.

obsdata

Observed data in wide format.

Author

Awa Diop, Denis Talbot

Examples

Run this code
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