Learn R Programming

rqlm (version 4.2-1)

stabwtlong: Calculating stabilized weights for IPW analysis: Longitudinal data

Description

This function calculates stabilized weights for IPW analysis of longitudinal data using logistic regressions. Both of untruncated and utruncated weights are provided.

Usage

stabwtlong(formula_denom, formula_num, data, trunc=c(0.01,0.99), digits=4)

Value

Truncated and untruncated stabilized weights are calculated.

  • sw1: Untruncated stabilized weights.

  • sw2: Truncated stabilized weights.

Arguments

formula_denom

An object of class "formula" (or one that can be coerced to that class): a symbolic description of the denominator logistic regression model to be fitted.

formula_num

An object of class "formula" (or one that can be coerced to that class): a symbolic description of the numerator logistic regression model to be fitted.

data

A data frame, list or environment (or object coercible by as.data.frame to a data frame) containing the variables in the model.

trunc

Quantiles to be truncated the weights (default: 0.01, 0.99).

digits

Number of decimal places in the output (default: 4).

References

Cole, S. R., and Hernan, M. A. (2008). Constructing inverse probability weights for marginal structural models. American Journal of Epidemiology 168, 656-664.

Westreich, D., Edwards, J. K., Lesko, C. R., Stuart, E., and Cole, S. R. (2017). Transportability of trial results using inverse odds of sampling weights. American Journal of Epidemiology 186, 1010-1014.

Examples

Run this code
data(exdata04)

stabwtlong(formula_denom = A ~ L1 + L2 + L3, formula_num = A ~ L1, data = exdata04)

Run the code above in your browser using DataLab