Closed victorn1 closed 6 years ago
abs
is definitely a strange argument that sometimes confuses me, but I think it's fairly clear in the documentation for love.plot
:
If no aggregation (e.g., over clusters or imputations) is to take place,
abs
will beTRUE
if it isTRUE
in the call tobal.tab
or in the call tolove.plot
. Otherwise, if balance is requested with multinomial or longitudinal treatments,abs
is set toTRUE
, and if balance is requested with clustered or multiply imputed data,abs
will take on the value of abs set in the original call tobal.tab
.
I know there's a lot going on, but see if your scenario matches one of the ones described. If you are using the standard binary treatment with no clustering, you should see absolute values in the plot if abs = TRUE
in the call to bal.tab
(which is not the default) or if abs = TRUE
in the call to love.plot
(which is the default). If you set abs = FALSE
in the call to love.plot
and don't change it in the call to bal.tab
, you should see values of different signs.
With aggregated data, which includes clustered data, multiply imputed data, multinomial treatments, and longitudinal treatments, the rules are a little different, but they're described in that quote from the love.plot
documentation.
Is the behavior of love.plot
not in line with the documentation? Which data scenario are you in?
The problem is that when, for a covariate, the unadjusted difference is positive and adjusted is negative the differences are both displayed as positive. I use just one-to-one matching.
Oh, I see. Yeah I'll investigate that, thanks!
Hm, I am unable to reproduce that error. When I run:
library(cobalt)
library(MatchIt)
data("lalonde", package = "cobalt")
covs <- subset(lalonde, select = -c(re78, treat))
m1 <- matchit(f.build("treat", covs), data = lalonde,
replace = TRUE, ratio = 2)
(b <- bal.tab(m1, un = TRUE))
#> Call
#> matchit(formula = f.build("treat", covs), data = lalonde, replace = TRUE,
#> ratio = 2)
#>
#> Balance Measures
#> Type Diff.Un Diff.Adj
#> distance Distance 1.7941 0.0043
#> age Contin. -0.3094 0.1352
#> educ Contin. 0.0550 0.0470
#> race_black Binary 0.6404 0.0054
#> race_hispan Binary -0.0827 -0.0081
#> race_white Binary -0.5577 0.0027
#> married Binary -0.3236 0.0514
#> nodegree Binary 0.1114 -0.0216
#> re74 Contin. -0.7211 -0.0588
#> re75 Contin. -0.2903 0.0291
#>
#> Sample sizes
#> Control Treated
#> All 429 185
#> Matched 125 185
#> Unmatched 304 0
love.plot(b, abs = FALSE)
Created on 2018-10-17 by the reprex package (v0.2.1)
You can see that the mean differences for re75
are in opposite directions in bal.tab
, and when I use love.plot
with abs = FALSE
, the points are where they belong. Are you able to produce a reproducible example?
Oh, I see. Everything works correct. I had a silly mistake in my code, that is why I got the issue. I checked it several times before, but found it just now. I am very sorry for taking you time. Thank you very much for your help!
It seems that love.plot() with abs=FALSE changes the sign of the adjusted (or of the unadjusted) differences. When I have unadjusted and adjusted differences of different signs, they are displayed as they have one sign.