0

I am trying to produce a classical "before" and "after" table reporting original cohort and pseudopopulation before and after an IPTW analysis using the WeightIt package.

Essentially, what I want is something like what is reported in the the example provided here: https://stats.stackexchange.com/questions/496599/calculate-single-absolute-standardized-difference-across-levels-of-a-categorical

I've tried to use bal.tab for that, but it seems that only balance summary can be accessed, and not the mean and SD or count and percentages for continuous and binary variables, respectively.

I can I do that?

I provide a workable example of an IPTW analysis.

library(WeightIt)
library(cobalt)
library(survey)

W.out <- weightit(treat ~ age + educ + race + married + nodegree + re74 + re75,
                  data = lalonde, estimand = "ATT", method = "ps")

bal.tab(W.out)
userq8957289475
  • 297
  • 1
  • 11

1 Answers1

1

You can use bal.tab() for this. Just set disp = c("means", "sds"). It's not as pretty as a tableone table but it does contain the same information and is immediately compatible with WeightIt. Note that the idea of a "weighted count" doesn't really apply because the weights are unscaled. Weighted means/proportions are valid, though, and you should report them and can do so with bal.tab().

Noah
  • 3,437
  • 1
  • 11
  • 27
  • Thank you for your reply. Just to be sure that I am interpreting correctly. When you say that "the idea of a weighted count doesn't really apply because the weights are unscaled" - this means that I cannot back-calculate the counts on the "after" table, since it doesn't take into account the effective sample size? I therefore suppose that reporting only the percentages for binary variables (without the counts) would be appropriate. – userq8957289475 May 15 '22 at 16:29
  • 1
    That's right. A weighted sum (i.e., count) would be the weighted mean times the sum of the weights, but the sum of the weights can be anything because different scalings of the weights don't affect their balancing ability, so multiplying your weighted mean by that number would be arbitrary. – Noah May 15 '22 at 20:11