2

I am looking at how sex impacts judicial decision making and am trying to balance my dataset where my treatment variable is named "gender.judge" (0 for control group, males, and 1 for treatment group, females). I want to balance the data on these relevant variables: jcs, confirmation year, party, racial minority, and judicial experience.

By using this code, I am able to create and add weights to my dataset. However, when I use the summarize function to assess whether the balancing was successful, I am left with different weighted means in the treatment and control groups.

Why is my entropy balancing not successfully weighting the covariates?

My code:

library(ebal)
library(data.table)

eb <- ebalance(Treatment = abortion$gender.judge, X = cbind(abortion$jcs, abortion$confirm.yr, abortion$party.judge, abortion$minority.judge, abortion$jud.experience))

#all the treated observations have weight=1

abortion_treat <- abortion |> filter(gender.judge==1) |> mutate(weights=1)

#control observations have weight based on the entropy balancing

abortion_con <- abortion |> filter(gender.judge==0) |> mutate(weights= eb$w)

abortion_balanced<- bind_rows(abortion_treat, abortion_con)

#Verifying that the groups were properly balanced

abortion_balanced |> group_by(gender.judge) |> summarize(weighted.mean(jcs, weights), weighted.mean(party.judge, weights), weighted.mean(confirm.yr, weights), weighted.mean(minority.judge, weights), weighted.mean(jud.experience,weights))

Liliana
  • 21
  • The ebal package is old and buggy. Try using WeightIt instead and assess balance with cobalt. There might be problems with how you manually manipulated the weights that would be avoided using the packages I recommended (which I also maintain). – Noah Apr 25 '23 at 07:11

0 Answers0