Skip to contents

The unstabilized weight 1/f(A|H,S) is unbounded: a unit whose observed treatment was nearly impossible given its history carries nearly infinite weight. Stabilization divides it by the probability of the same treatment under a model that drops the history, leaving the weighted pseudo-population unchanged but shrinking the weights towards one. Keeping the stratum variables in the numerator makes the weights valid for a marginal structural model that conditions on the stratum. Both models are logistic regressions fitted by IRLS.

Usage

Strtwt(A, H = NULL, S = NULL)

Arguments

A

Binary treatment coded 0/1.

H

Optional history covariates, n by p. If NULL the two models coincide and every weight is exactly one.

S

Optional stratum covariates, n by q, entering both models.

Value

List with estimate (mean weight), weights, unstabilized, num, den, max, min, sd, n, method.

Details

Formula: sw_i = f(A_i | S_i) / f(A_i | H_i, S_i).

References

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

Examples

Strtwt(c(1, 0, 1, 1, 0, 1, 0, 0), NULL, matrix(c(0, 0, 1, 1, 0, 1, 1, 0), 8, 1))
#> $estimate
#> [1] 1
#> 
#> $weights
#> [1] 1 1 1 1 1 1 1 1
#> 
#> $unstabilized
#> [1] 4.000000 1.333333 1.333333 1.333333 1.333333 1.333333 4.000000 1.333333
#> 
#> $num
#> [1] 0.25 0.75 0.75 0.75 0.75 0.75 0.25 0.75
#> 
#> $den
#> [1] 0.25 0.75 0.75 0.75 0.75 0.75 0.25 0.75
#> 
#> $max
#> [1] 1
#> 
#> $min
#> [1] 1
#> 
#> $sd
#> [1] 0
#> 
#> $n
#> [1] 8
#> 
#> $method
#> [1] "sw = f(A|S) / f(A|H,S), stabilized IPTW [Cole & Hernan 2008]"
#>