Applying weights to Oaxaca Blinder Decomposition

I have a variable PERWT from ipums usa microdata (which represents the weights for each observation). If PERWT in my sample data set is equal to 100, then this observation is representative of 100 observations in the population data set. Those weights need to be applied when running the Oaxaca-blinder decomposition. However my current code doesnt seem to work. I am open to hear your opinion or suggestion on how to do it.

current code that works without weights:

data1940_male <- data %>%
filter(race %in% c(0,1), EMPLOYMENT==1, merged_hours==40,  INCWAGE!=0, BIRTHYR == 1940, gender==0,merged_race %in%     c("White",     "Black"))
data1940_male$gender <- factor(data1940_male$gender, levels =     c(0, 1))
results1940_male<- oaxaca(formula=log(INCWAGE)~INDUSTRY+YREDUCATION+EXPERIENCE| race, data= 
data1940_male, R=2,  group.weights = 0)

trying to apply weights but unsuccessfully:

model_data <- data1940_male[, c("INCWAGE", "INDUSTRY",  "YREDUCATION", "EXPERIENCE", "race",  
"IPW","PERWT")]
data_group0 <- subset(model_data, race == 0)
data_group1 <- subset(model_data, race == 1)
model_data$ln_INCWAGE <- log(model_data$INCWAGE)

design <- svydesign(ids = ~1, data = model_data, weights =  ~PERWT)

model1 <- svyglm(log_INCWAGE ~ INDUSTRY + YREDUCATION + EXPERIENCE, design = design, subset = race == 0)
model2 <- svyglm(log_INCWAGE ~ INDUSTRY + YREDUCATION + EXPERIENCE,  design = design, subset = race == 1)

 oaxaca_result <- oaxaca(log_INCWAGE ~ INDUSTRY + YREDUCATION + EXPERIENCE | race, data = model_data, weights =     model_data$PERWT, reg.fun = svyglm, design = design,  R=2,ind=c(0,1))

The documentation for Oaxaca says the argument is group.weights rather than weights. Also says the weights have to be between zero and one, which I don't think is true for PERWT.

Hey, thanks for your suggestion! group.weights is used for defining the reference group (which is compared to the comparison group) thats why should be 0 or 1, while there should be a different argument specifying the weights for the observations. let me know what you think about it!

You're quite right. I don't think the Oaxaca package allows for individual weights...which is a bit surprising.

I believe the ref.fun should be used together with the weights argument. Even if you have an idea to do the calculation manually without using oaxaca, let me know. Thank you!

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.