ngreifer / cobalt

Covariate Balance Tables and Plots - An R package for assessing covariate balance
https://ngreifer.github.io/cobalt/
73 stars 11 forks source link

Unadjusted standardized difference #20

Closed Blanch-Font closed 5 years ago

Blanch-Font commented 5 years ago

I check the unadjusted standardized difference.

I have the follow table: user h02 N tp 1: control 0 131071 0.98487421 2: control 1 2013 0.01512579 3: user 0 13904 0.97929286 4: user 1 294 0.02070714

I calculated the standardized difference as Austin: (0.02070714 - 0.01512579)/sqrt((0.015125790.98487421 + 0.020707140.97929286)/2) = 0.0420858

But bal.tab returns 0.0056

bal.tab(formula = user ~ h02, data = data)

Balance Measures Type Diff.Un h02 Binary 0.0056

Sample sizes Control Treated All 133084 14198

ngreifer commented 5 years ago

By default, bal.tab produces the raw, unstandardized mean difference for binary variables (because standardization doesn't provide any more information than the raw difference in means). This is detailed in the help page for bal.tab, which can be reached with ?bal.tab, and the vignette. You can change this by setting binary = "std" in the call to bal.tab.