I want to balance my data using the WeightIt package in R (method= ebal
). I have used a code similar to the one below;
#Balancing covariates between treatment groups (binary)
W1 <- weightit(treat ~ age + educ + married + nodegree + re74, data = lalonde, method = "ebal", estimand = "ATT")
match.data(W1)
The outcome is my data table with an additional column called weights
. What do those weights mean and how do I go on from here? (My next step would be to do a logit regression with a balanced dataset)
Thank you so much for helping!
weightit()
estimates weights that, when applied to a dataset, yield balance in the treatment groups. To estimate effects in the weighted sample, include the weights in a regression of the outcome on the treatment. This is demonstrated in the WeightIt vignette.You should not used
match.data()
withWeightIt
. I'm not sure where you found the code to do that.match.data()
is for use withMatchIt
, which is a different package with its own functions. The fact thatmatch.data()
happened to work withWeightIt
is unintended behavior and should not be relied on.To estimate the effect of the treatment on a binary outcome (which I'll denote as
Y
in the code below and assume is in thelalonde
dataset, even though in reality it is not), you would run the following after running the first line in your code above:The coefficient on
treat
is the log odds ratio of the outcome.