I am trying to add weights produced with the entropy balancing reweighting ebal package to a dataframe in order to use them thereafter in regression analysis with balanced samples. The code that that I used for weighting is:
# install.packages("ebal")
library(ebal)
out.eb<- ebalance(Treatment=Treatment,X=X,constraint.tolerance = 2)
To then add the weights to the dataframe I assumed that treatment units are weighted as 1, and that control units should get the weights that were produced with ebal, so:
data$weights <- ifelse(Treatment==1,1,out.eb$w)
I think that I got it wrong, but am not sure what would be the right solution. Would be grateful for your advice.